[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Copy all except one



This one time, at band camp, Russell said:
> john wrote:
> > 
> > In local.debian.user, you wrote:
> > > debpc:/# if [-d bin]; then; echo "yes"; fi;
> > > i get:
> > >   bash: syntax error near unexpected token ';'
> > >
> > > Why? I've tried various ways to fix it.
> > 
> > Take out the ; after 'then'.
> 
> That did it! (as well as putting spaces around the
> brackets as another poster said)
> 
> I got confused because this works
> in a script:
> 
>   if [ -d bin ]
>   then           <-
>     echo "Yes"   <- new line
>   fi

Yes and no - much of the time the indented lines could be rewritten
inline :

if [ -d /bin ]
then echo "Yes"
fi

The indents are to ease eyestrain, mostly.

HTH,
Steve
-- 
Most people's favorite way to end a game is by winning.

Attachment: pgp3tCwxXZThl.pgp
Description: PGP signature


Reply to: