bash query
dave selby
dave6502 at googlemail.com
Sun Jun 3 09:18:19 UTC 2007
Hi,
I am writting a bash script but am pretty rusty. This demo script
shows my problem
#!/bin/bash
read KEY
if [ $KEY = "q" ];
then
echo "a QQQQQQQQQQQQQQQ"
fi
dave at dev-machine:~$ ./test.sh
d
dave at dev-machine:~$ ./test.sh
q
a QQQQQQQQQQQQQQQ
dave at dev-machine:~$ ./test.sh
./test.sh: line 5: [: =: unary operator expected
dave at dev-machine:~$
ie how do I error catch a straight enter key being pressed without a
character first ?
Cheers
Dave
--
The unavoidable price of reliability is simplicity.
-- C.A.R. Hoare
More information about the ubuntu-users
mailing list