/bin/[ ?? What is this?
It is a hard link to /bin/test (or vica versa). You can tell by noting
that they have the same inode number:
isis$ ls -i /bin/test
595245 /bin/test
isis$ ls -i /bin/[
595245 /bin/[
Type "man test" and you will see why (sort of).
Ian
--
Ian Gregory
http://www.zenatode.org.uk/ian/
When you create a script with
if [ $# = 0 ]; then
echo no arguments
fi
You are really doing
if test $# = 0; then
echo no arguments
fi
In other words, the [ in an 'if' statement is NOT part of the 'if'
syntax, but rather a separate program called 'test'. This is
because the file '[' is either a hard link to the file 'test' or
just a copy of 'test'.
% cksum /bin/[ /bin/test
3588315430 46720 /bin/[
3588315430 46720 /bin/test
Years ago when the shell had to fit in 64 kilobytes, including all
data and the stack, it was important to leverage the use of
external programs as much as possible.
Today, the POSIX shell (as well as bash, ksh, zsh) have more
memory to work with and now support built-in [[ ... ]] syntax
parsing.
Bob Harris