From owner-freebsd-questions Sun Jun 20 18:44:16 1999 Delivered-To: freebsd-questions@freebsd.org Received: from wfdutil3gw.ml.com (wfdutil3f01.ml.com [206.3.74.33]) by hub.freebsd.org (Postfix) with ESMTP id ABA4415170 for ; Sun, 20 Jun 1999 18:44:12 -0700 (PDT) (envelope-from mwang@tech.cicg.ml.com) Received: from ewfdav02.ml.com ([199.201.57.18]) by wfdutil3gw.ml.com (8.9.3/8.9.3/MLgwo-4.03) with SMTP id VAA28594 for ; Sun, 20 Jun 1999 21:44:12 -0400 (EDT) Received: from 172.23.143.207 by ewfdav02.ml.com (InterScan E-Mail VirusWall NT); Sun, 20 Jun 1999 21:44:06 -0400 (Eastern Daylight Time) Received: by cicgload-fs1-p.tech.cicg.ml.com (8.8.8+Sun/ML55SMX-1.02) id VAA04783; Sun, 20 Jun 1999 21:44:11 -0400 (EDT) Date: Sun, 20 Jun 1999 21:44:11 -0400 (EDT) From: mwang@tech.cicg.ml.com (Michael Wang) Message-Id: <199906210144.VAA04783@cicgload-fs1-p.tech.cicg.ml.com> To: freebsd-questions@FreeBSD.ORG Subject: Re: what is the command named "[" in /bin directory? Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > 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