[X-Unix] /bin strange directory ??

Cloyce D. Spradling cloyce+xunix at headgear.org
Mon May 23 18:48:00 PDT 2005


On Mon, May 23, 2005 at 08:20:20PM -0500, David Gilden wrote:

: what is '['

It is a handy shorthand for 'test'.

In a shell script, when you see

  if [ "$FOO" = bar ]; then

you probably thought that it was all internal.  Not so!  The above is
equivalent to

  if test "$FOO" = bar; then

That link to '[' is an important part of the above recipe.  All the shell
does is ignore the ']'. :)

: Is this '[' garbage that I can RM?

NO!  The only time I did this I discovered that my system had been rendered
unbootable.  (For the record, it was a 386BSD system.  Pretty much any Unix
or Unix-like system will have some startup scripts that expect to be able
to run test(1) via '['.)

--
Cloyce


More information about the X-Unix mailing list