Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!relay.nswc.navy.mil!oasys!mimsy!dftsrv!croten From: croten@ltpsun.gsfc.nasa.gov (Charles D. Roten) Newsgroups: comp.unix.questions Subject: Bourne shell syntax problem? Summary: What goof am I committing? Keywords: bourne shell arguments stupidity Message-ID: <4973@dftsrv.gsfc.nasa.gov> Date: 18 Apr 91 20:30:06 GMT Sender: news@dftsrv.gsfc.nasa.gov Followup-To: comp.unix.questions Distribution: usa Organization: NASA/GSFC Biospheric Sciences Branch Lines: 96 I am having trouble getting a Bourne shell to run, and have come to suspect that the problem is in the section where I parse the variables. The script is rather long (~260 lines) so I will only include the suspect portion. -------------------- script follows -------------------- #!/bin/sh [comments deleted] sourcepath=/tmp/zmcdr/tmp mailhost=charney.gsfc.nasa.gov tmpdir=/tmp/zmcdr mailback=0 interactive=0 verbose=0 built=0 dataset=0 normset=0 database=0 localdata=fort.10 localnormal=fort.15 data="" normal="" maildest="" [stuff that already works deleted] # Switch on the verbosity. set -x # Go to the 'working' directory cd $tmpdir # Now, parse the rest of the arguments, for cases where there are 1 or more # arguments. for i in $*; do case $i in -b) rm temp echo '/c idbase = 1' > temp echo 's/c/ /' >> temp sed -f temp $sourcepath/beat.f > newbeat.f mv newbeat.f beat.f database=1 built=1;; -m) mailback=1;; -d) shift datastring=$i dataset=1;; -n) shift normstring=$i normset=1;; -v) verbose=1;; -i) interactive=1;; *) if test "$data" = ""; then data=$i elif test "$normal = ""; then normal=$i elif test "$maildest" = ""; then maildest=$i else break fi esac done [stuff never reached deleted] -------------------- end of script -------------------- Here are the symptoms. -------------------- begin session log -------------------- $ jobshell zcpjd.m60.tok.data zcpjd.m60.toka.data + cd /tmp/zmcdr ./jobshell: syntax error at line 269: `end of file' unexpected $ wc -l jobshell 268 jobshell -------------------- end session log -------------------- The first command in the section I quoted after 'set -x' executes. Nothing else does. I think I hosed the syntax in the section I quoted. I am fairly sure it *is* a programming error and not just a bug in this particular port of the Bourne shell because I ran versions of this script on both a Sun and a Cray with the same results. BTW, my login shells on both machines are /bin/csh, but I was in /bin/sh when testing. I would greatly appreciate an explanation of the the nature of the goof. Thanks in advance. -- Charles Roten | STX, Incorporated Internet: croten@ltpsun.gsfc.nasa.gov [best] *OR* zmcdr@charney.gsfc.nasa.gov smail: 9701 L Philadelphia Court, Lanham, MD 20706 phone: (301) 306-1006 (work) ; (301) 317-0872 (home)