TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [TCLUG:1502] odd bash script problem
thanks, works like a charm
Ben Luey
lueyb@carleton.edu
On Tue, 29 Sep 1998, Nate Carlson wrote:
> Try changing the 'if [ $2 = "new" ]' to 'if [ "$2" = "new" ]' .. I don't
> know much about bash, but you can run into problems with it thinking there
> is nothing to the left of the = if you do not use quotes to specify
> blank.. so if you enter nothing for $2, bash may be interpret the way you
> have it like 'if [ = "new" ]' instead of 'if [ <blank> = "new" ]'.. give
> it a try, I could be wrong tho.
>
> -Nate Carlson
> the Infinite Loop
> natecars@infiniteloop.com
>
> On Tue, 29 Sep 1998, Ben Luey wrote:
>
> > I'm new to bash and I'm trying to write a little script to load a new
> > window of netscape if I type newnetscape usr new and a act normal
> > otherwise here is the script:
> >
> > #!/bin/sh
> >
> > if [ $2 = "new" ]
> > then
> > netscape -remote "openURL ($1, new-window)"&
> > fi
> > netscape -remote "openURL ($1)"&
> >
> > It works except when I don't have new as $2, I get the following message
> >
> > [lueyb@pcLueyB /]$ newnetscape http://www.linuxnow.com
> > /usr/local/bin/newnetscape: [: =: unary operator expected
> >
> >
> > What's wrong?
> >
> > Thanks,
> > Ben
> >
> >
> >
> >
> > Ben Luey
> > lueyb@carleton.edu
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tclug-list-unsubscribe@listserv.real-time.com
> > For additional commands, e-mail: tclug-list-help@listserv.real-time.com
> > Try our website: http://tclug.real-time.com
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tclug-list-unsubscribe@listserv.real-time.com
> For additional commands, e-mail: tclug-list-help@listserv.real-time.com
> Try our website: http://tclug.real-time.com
>