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

Re: Bash script question (was: Re: Netscape 4.73 wrapper broken)



** On Jun 24, Mark Phillips scribbled:
> Corey Popelier [pancreas@dingoblue.net.au] wrote:
> 
> > Yes I have this problem also. I assume we shall await a fix. And use
> > Mozilla in the meantime :)
[snip]
> And the problem seems to be with a syntax error at the line
> 
>                 for f in (cd $d;ls -1 . | sort); do
> 
> According to "man bash", the "(cd $d;ls -1 . | sort)" is a compound
You shouldn't rely on what bash supports or not. The Debian shell scripts
are supposed to be POSIX-compatible, and not everything bash implements is
POSIX.

> command where the stuff in brackets is executed in its own shell.  So
> what this line seems to be trying to do, is to go to a certain
> directory, get a sorted listing of the files there and then go through
> them one by one, executing ". $d/$f" for each of them.  What is the
> "." command???  I thought it was the current directory?
It's the 'source' command. It takes its argument and interprets the file as
a shell code - you might think of it as sort of dynamic linking for scripts.

> Anyway, the reason for the syntax error is with the definition of a
> for loop in bash.  From "man bash":
> 
>   for name [ in word ] ; do list ; done
Again, don't rely on bash being the /bin/sh. Debian scripts cannot do that.

> Now "word" is a list of blank separated words I believe, so it does
> not allow the "(cd $d;ls -1 . | sort)" construction to be used here.
> So somehow we need to find an alternative.
I don't use that script, but I think adding $ before the first bracket would
do the trick.

> Any ideas?
Upgrade :)) - it will have been fixed when you read those words most
probably :))

marek

Attachment: pgpIBXEp96iz7.pgp
Description: PGP signature


Reply to: