bash query

Danny Colligan dannycolligan at gmail.com
Sun Jun 3 15:29:29 UTC 2007


See this excellent reference on bash: http://tldp.org/LDP/abs/html/

And some common tasks in bash:
http://wooledge.org/mywiki/BashFAQ?action=show&redirect=BashFaq#head-7dfd029fd0b209ba25bb2659744e1f47734bde4c

Danny Colligan

> On 03/06/07, Andy <stude.list at googlemail.com> wrote:
> > On 03/06/07, dave selby <dave6502 at googlemail.com> wrote:
> > > #!/bin/bash
> > > read KEY
> > > if [ $KEY = "q" ];
> > > then
> > > echo "a QQQQQQQQQQQQQQQ"
> > > fi
> > > [snip]
> > > dave at dev-machine:~$ ./test.sh
> > >
> > > ./test.sh: line 5: [: =: unary operator expected
> > > dave at dev-machine:~$
> >
> > Use "$KEY" instead of $KEY , that way if $KEY has no value it
> > evaluates to the empty string ""
> >
>
>
> Thanks for that - makes sense
>
> Cheers
>
> Dave
>




More information about the ubuntu-users mailing list