Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Jun 1999 21:44:11 -0400 (EDT)
From:      mwang@tech.cicg.ml.com (Michael Wang)
To:        freebsd-questions@FreeBSD.ORG
Subject:   Re: what is the command named "[" in /bin directory?
Message-ID:  <199906210144.VAA04783@cicgload-fs1-p.tech.cicg.ml.com>

next in thread | raw e-mail | index | archive | help
> > Dear FreeBSDers:
> >
> > What is the command named "[" in /bin as shown below?
> 
> It's a synonym for 'test':
> 
>   $ls -li /bin/[ /bin/test
>   1435 -r-xr-xr-x  2 root  wheel  48732 Jun 18 11:29 /bin/[
>   1435 -r-xr-xr-x  2 root  wheel  48732 Jun 18 11:29 /bin/test
> 
> It's used for things like:
> 
>   if [ -f /unix ]; then
>     echo "System V";
>   elif [ -f /kernel ]; then
>     echo BSD;
>   fi

Thank you very much for the quick response. Solaris [System V]
treats test, cd, alias, bg, ..., 17 such "command" as ksh built in. See
below. It is interesting to see that BSD treats "[" as a real command. 

Thanks again.

Michael Wang
http://www.mindspring.com/~mwang

[julie:/opt/home/root]more  /usr/bin/test  
#!/bin/ksh
#
#ident  "@(#)alias.sh   1.1     95/02/06 SMI"
#
# Copyright (c) 1995 by Sun Microsystems, Inc.
#
cmd=`basename $0`
$cmd "$@"

[julie:/opt/home/root]ls -lsdi  /usr/bin/test        
245612 1 -r-xr-xr-x 17 bin bin 131 Oct 6 1998 /usr/bin/test

[julie:/opt/home/root]find /usr/bin -inum 245612     
/usr/bin/alias
/usr/bin/bg
/usr/bin/cd
/usr/bin/command
/usr/bin/fc
/usr/bin/fg
/usr/bin/getopts
/usr/bin/hash
/usr/bin/jobs
/usr/bin/kill
/usr/bin/read
/usr/bin/test
/usr/bin/type
/usr/bin/ulimit
/usr/bin/umask
/usr/bin/unalias
/usr/bin/wait


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?199906210144.VAA04783>