Re: Shell scripting in Bash
Dale Scheetz writes:
>I have been trying to learn shell scripting using the man page for
>bash. Asside from the need for a lot of reading between the lines,
>there seem to be several errors. == is declared to be the equality
>operator, but = is the correct syntax.
You're confusing arithmetic evaluation with the syntax of test(1).
>|| is declared to be the or operator, but although:
>
>if [ a != b ]
>
>works fine
>
>if [ a != b || c != d ]
>
>fails with several errors ( ']' not found, and != command not found )
Use `-o' instead of ||. You should read the man page for test(1), or
the section of the bash man pages which deals with the built-in
version. And read some shell scripts written by other people l-)
--
Richard Kettlewell
http://www.elmail.co.uk/staff/richard/ richard@elmail.co.uk
Hanging is too good for a man who makes puns; he should be drawn and quoted.
-- Fred Allen
Reply to: