Bash Problem

Sean McMahon smcmahon at usgs.gov
Thu Apr 28 14:29:16 EDT 2005


So bash does work the same way as sh does, in that she is also missing the
double quote around the echo statement.  single quotes for echo statements
without variables, double quotes for echo statements with variables.  I'd like
to point out for portability, I always use sh instead of bash.  You can probably
give the script the -x argument to debug it.
----- Original Message ----- 
From: "David Bruzos" <david at bruzos.org>
To: "Speakup is a screen review system for Linux." <speakup at braille.uwo.ca>
Sent: Thursday, April 28, 2005 7:49 AM
Subject: Re: Bash Problem


> Hi Janina:
> Could it be that you are missing the declaration of the "$i" variable.  I
added it and it worked for me.  This is what I
> got:
>
> #!/bin/bash
>
> for i in $(ls); do
> if [ "$i" != "incoming/" ]; then
> echo "$i"
> fi
> done
>
> It seems as if you are missing the "i" after the "for".
>
> HTH
>
> David B.
>
> On Thu, Apr 28, 2005 at 10:03:25AM -0400, Janina Sajka wrote:
> > I'm confused over some simple bash syntax. If I write the following at
> > the bash (ver 3.0) prompt, all works as expected--no errors.
> >
> > But, if I execute from a script file (which begins with a #!/bin/bash of
> > course), I get:
> >
> > line 4: syntax error near unexpected token `then'
> >
> > What am I missing? All help much appreciated.
> >
> >
> > for in $( ls); do
> > if [ "$i" != "incoming/" ]; then
> > echo $i
> > fi
> > done
> >
> >
> > -- 
> >
> > Janina Sajka Phone: +1.202.494.7040
> > Partner, Capital Accessibility LLC http://www.CapitalAccessibility.Com
> >
> > Chair, Accessibility Workgroup Free Standards Group (FSG)
> > janina at freestandards.org http://a11y.org
> >
> > If Linux can't solve your computing problem, you need a different problem.
> >
> >
> > _______________________________________________
> > Speakup mailing list
> > Speakup at braille.uwo.ca
> > http://speech.braille.uwo.ca/mailman/listinfo/speakup
>
> _______________________________________________
> Speakup mailing list
> Speakup at braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup





More information about the Speakup mailing list