Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Jan 1999 13:24:30 +0000
From:      Ben Smithurst <ben@scientia.demon.co.uk>
To:        cjclark@home.com
Cc:        FreeBSD Questions <freebsd-questions@FreeBSD.ORG>
Subject:   Re: Documentation of '[]'
Message-ID:  <19990113132430.A78574@scientia.demon.co.uk>
In-Reply-To: <199901130625.BAA04054@cc942873-a.ewndsr1.nj.home.com>
References:  <199901130625.BAA04054@cc942873-a.ewndsr1.nj.home.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Crist J. Clark wrote:

> You get the 'test(1)' manpage as you should, but there is no mention
> of how and when '[]' can be used instead of 'test.'

Anywhere. There is no difference, except that you must use a "]" as the
last argument with "]", you don't with "test". (i.e.,

test -f /foo
[ -f /foo ]

are the same.

[ -f /foo
test -f /foo ]

are syntax errors. But you knew that.) There may be another difference,
I think some shells may have one or both as a shell builtin, though it's
likely to affect both and so won't affect your choice of which to use. I
prefer "[ ... ]" since it looks nicer IMO, but YMMV.

-- 
Ben Smithurst
ben@scientia.demon.co.uk

send a blank message to ben+pgp@scientia.demon.co.uk for PGP key

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990113132430.A78574>