zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: "DPD" <dpd@asan.com>, zsh-users@math.gatech.edu
Subject: Re: "Parse Error: Condition Expected"
Date: Sun, 3 Nov 1996 10:54:47 -0800	[thread overview]
Message-ID: <961103105447.ZM27640@candle.brasslantern.com> (raw)
In-Reply-To: "DPD" <dpd@asan.com> ""Parse Error: Condition Expected"" (Nov  3, 12:41pm)

On Nov 3, 12:41pm, DPD wrote:
} Subject: "Parse Error: Condition Expected"
}
}         if [ $user = "" ]               ************************** LINE #48
}             if [ $user = "root" ]      *************************LINE #54

Change those to

        if [ "$user" = "" ]
            if [ "$user" = "root" ]

and your parse errors will go away.

} After some searchin', I used the "od -a 'filename'" command to look at
} the output  each time the loop went through.  I found that the last 
} read was storing an 'nl' in the variable "user" - which I hypothesized 
} to mean 'new line' (correct me if I'm wrong).
} (BTW, the first line of the od output is: 0000000  nl)

There's no "nl" stored in $user -- there's an empty string stored in it.
The "nl" is an artifact of how you ran "od" as far as I can tell.

} Apparently and rightfully so, this issue is causing the 'parse 
} error...' in both of the "if" statements within this loop...right??

What's causing the parse error is that $user is empty, so zsh sees

	if [ = "" ]

You have to put quotes around the variable reference to turn an empty
variable into an empty string for parsing purposes.


-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern


  reply	other threads:[~1996-11-03 19:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-11-03 17:41 DPD
1996-11-03 18:54 ` Bart Schaefer [this message]
1996-11-03 18:59 ` Zefram

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=961103105447.ZM27640@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=dpd@asan.com \
    --cc=schaefer@nbn.com \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).