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

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



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 :)

Or we could try to fix it... the error is with the code:

        for d in \
/usr/lib/netscape/base-4/wrapper.d \
/usr/lib/netscape/$VER \
/usr/lib/netscape/$VER/$BIN ;do
                for f in (cd $d;ls -1 . | sort); do
                        . $d/$f
                done
        done

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
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?

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

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.

Any ideas?

Thanks,

Mark.

P.S. For any replies, please cc a copy directly to me.


> On Fri, 23 Jun 2000, Mark Phillips wrote:
> 
> > I've just updated my system to the current frozen, and included in
> > this update was the installation of netscape 4.73.
> > 
> > When I now run netscape, it bombs out, complaining of:
> > 
> > $ netscape            
> > /usr/bin/X11/netscape: line 277: syntax error near unexpected token `(c'
> > /usr/bin/X11/netscape: line 277: `              for f in (cd $d;ls -1 . | sort); do'
> > 
> > Has anyone else had this problem?  Does anyone else know the fix?
> > 
> > Thanks,
> > 
> > Mark.
> > 
> > P.S. Please cc a copy of any reply directly to me as I currently read
> > the list only via the archives --- and I can't even do that now that
> > netscape is not working.
> > 
> > -- 
> > _/~~~~~~~~\___/~~~~~~\____________________________________________________
> > ____/~~\_____/~~\__/~~\__________________________Mark_Phillips____________
> > ____/~~\_____/~~\________________________________mark@ist.flinders.edu.au_
> > ____/~~\HE___/~~\__/~~\APTAIN_____________________________________________
> > ____/~~\______/~~~~~~\____________________________________________________
> > __________________________________________________________________________
> >         "They told me I was gullible ... and I believed them!" 
> > 
> > 
> > -- 
> > Unsubscribe?  mail -s unsubscribe debian-user-request@lists.debian.org < /dev/null
> > 
> 

-- 
_/~~~~~~~~\___/~~~~~~\____________________________________________________
____/~~\_____/~~\__/~~\__________________________Mark_Phillips____________
____/~~\_____/~~\________________________________mark@ist.flinders.edu.au_
____/~~\HE___/~~\__/~~\APTAIN_____________________________________________
____/~~\______/~~~~~~\____________________________________________________
__________________________________________________________________________
        "They told me I was gullible ... and I believed them!" 



Reply to: