bash query
Andy
stude.list at googlemail.com
Sun Jun 3 09:23:34 UTC 2007
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 ""
--
First they ignore you
then they laugh at you
then they fight you
then you win.
- Mohandas Gandhi
More information about the ubuntu-users
mailing list