From: "DPD" <dpd@asan.com>
To: zsh-users@math.gatech.edu
Subject: "Parse Error: Condition Expected"
Date: Sun, 3 Nov 1996 12:41:27 -0500 [thread overview]
Message-ID: <17404688102380@asan.com> (raw)
Hello there!
(Please mail all destructive comments to /dev/null...I'll get to
those later..Thanks!)
Here is a portion of the entire script.
This module essentially reads my /etc/group file, pulls out all users
(currently domenick, sysop, root) in a particular group (sysop) and
stores them in a variable for later processing.
For logical purposes, the file "~/tmp/.sysop.users.group" in the
following script already contains the extracted list of users from the
sysop group; i.e, when 'cat'ed to the screen, this file contains
data formatted as "domenick,sysop,root".
This portition of the script:
---------------------------------------------------------------
control="start"
integer count=1
until [ $control = "stop" ]
do
user=`cut -d "," -f $count ~/tmp/.sysop.users.group`
if [ $user = "" ] ************************** LINE #48
then
# stop the loop
control="stop"
else
if [ $user = "root" ] *************************LINE #54
then
# Don't include root in the list!
count=$count+1
else
echo "$user " >> ~/tmp/.list.group
count=$count+1
fi
fi
done
new_list=`cat ~/tmp/.list.group`
--------------------------------------------------------------------
Produces this (continous) output (which is ultimately 'kill'ed):
*****************************************
./group.zsh: parse error: condition expected: = [48]
./group.zsh: parse error: condition expected: = [54]
./group.zsh: parse error: condition expected: = [48]
./group.zsh: parse error: condition expected: = [54]
./group.zsh: parse error: condition expected: = [48]
./group.zsh: parse error: condition expected: = [54]
./group.zsh: parse error: condition expected: = [48]
./group.zsh: parse error: condition expected: = [54]
*****************************************
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)
Great! Now how do I write the script to stop processing on this
encounter??? Please feel free to interject your comments/ideas.
One crude(?) idea which quickly comes to mind is to basically using
the 'od -a' command to capture each read and then compare it to the set
value of "0000000 nl"....if they match, then stop the loop...
There has got to be a better way to do this.....
Apparently and rightfully so, this issue is causing the 'parse
error...' in both of the "if" statements within this loop...right??
BTW, I'm running zsh version 3.0.0.
Thanks for all your help!
Dom
next reply other threads:[~1996-11-03 18:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-11-03 17:41 DPD [this message]
1996-11-03 18:54 ` Bart Schaefer
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=17404688102380@asan.com \
--to=dpd@asan.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).