Paul Howarth wrote:I also find it useful to think of the "[" in the "if" statement:
if [ x = y ]; then ...
as being the same as the command "test" (see man test). When you think of it ("[") as a command (which it is), the need for a space after it is more obvious in my mind.
Paul.
So much so that '[' is a sym link to test:
ls -l /usr/bin/[ lrwxrwxrwx 1 root root 4 Mar 13 2004 /usr/bin/[ -> test
Indeed, but both [ and test are builtins in bash so it won't use the ones in /usr/bin unless you specifically tell it to.
Paul.