bash query
dave selby
dave6502 at googlemail.com
Sun Jun 3 09:53:31 UTC 2007
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
>
>
> --
> First they ignore you
> then they laugh at you
> then they fight you
> then you win.
> - Mohandas Gandhi
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>
--
The unavoidable price of reliability is simplicity.
-- C.A.R. Hoare
More information about the ubuntu-users
mailing list