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

Re: Copy all except one



Bob Proulx wrote:
> 
> Russell <rjshaw@iprimus.com.au> [2002-08-24 18:10:10 +1000]:
> > Thanks; i wanted to copy the directory names but without
> > recursion into the contents. I'll use mkdir then. I've
> > been making a bash script to copy all the directories
> > except for a few. When i type at the bash prompt:
> > 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.
> 
> Chuckle.  The exact answer is that you have a syntax error.  :-)
> 
> You need spaces around your '[' and ']' characters.  The '[' is an
> actual shell command.  You need spaces around them.  The difference
> between '[-d' and '[ -d' is the same as the difference between
> 'echoyes' and 'echo yes'.
> 
> Try this.
> 
>   if [ -d bin ]; then; echo "yes"; fi;

Hi, i realized later from the Bash book that i needed those spaces,
and i tried the above line, but i still get the same error:(
There's a gnu.bash newsgroup, but i can't get it yet.
 
> Bob
> 
> BTW, Fortran was written by people who wanted to ignore spaces.  The
> language parser scans the line and ignores spaces entirely.  Really.
> It makes errors like these go away.  This was done since usually in
> those days a programmer would give a hand written program to an
> assistent who would then type it in.  Since the assistent did not know
> the code there was no way to get the spaces right.  So they wrote the
> language specifically to avoid needing to.  Conversely you needed to
> count the spaces at the start of the line to make sure things were in
> the right column.  But you could teach that easily.  This is one of
> the things that makes Fortran so much fun to pick at years later.

Interesting. Does fortran have any advantages over current languages?
IIRC, it was used mostly by maths types.



Reply to: