Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Jun 1999 07:40:27 -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:  <199906211140.HAA05809@cicgload-fs1-p.tech.cicg.ml.com>

next in thread | raw e-mail | index | archive | help
> > 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.
> 	[ML]  They are built in in pdksh, bash, tcsh, etc as well.
> 
> 	They are not built in in /bin/sh.  Not even in Solaris.  And
> /bin/sh is the standard scripting shell.  However, the /bin/sh may be
> internally interpreting [ as a call to test (which the FreeBSD /bin/sh
> apparently does not do, hence /bin/[).

How did you conclude that they are not built in in /bin/sh
in Solaris? My conclusion is test and "[" are /bin/sh built-ins. test
is a built-in per shell_builtins man page, and [ ... ] is the same as
test. There is no "[" command in Solaris. 

The following is a list of shell_builtins from man page in Solaris: 

              command                       built into

     alias                         csh, ksh
     bg                            csh, ksh, sh
     break                         csh, ksh, sh
     case                          csh, ksh, sh
     cd                            csh, ksh, sh
     chdir                         csh, sh
     continue                      csh, ksh, sh
     dirs                          csh
     echo                          csh, ksh, sh
     eval                          csh, ksh, sh
     exec                          csh, ksh, sh
     exit                          csh, ksh, sh
     export                        ksh, sh
     fc                            ksh
     fg                            csh, ksh, sh
     for                           ksh, sh
     foreach                       csh
     function                      ksh
     getopts                       ksh, sh
     glob                          csh
     goto                          csh
     hash                          ksh, sh
     hashstat                      csh
     history                       csh
     if                            csh, ksh, sh
     jobs                          csh, ksh, sh
     kill                          csh, ksh, sh
     let                           ksh
     limit                         csh
     login                         csh, ksh, sh
     logout                        csh, ksh, sh
     nice                          csh
     newgrp                        ksh, sh
     notify                        csh
     onintr                        csh
     popd                          csh
     print                         ksh
     pushd                         csh
     pwd                           ksh, sh
      read                         ksh, sh

SunOS 5.7            Last change: 1 Feb 1995                    1

User Commands                                   shell_builtins(1)

     readonly                      ksh, sh
     rehash                        csh
     repeat                        csh
     return                        ksh, sh
     select                        ksh
     set                           csh, ksh, sh
     setenv                        csh
     shift                         csh, ksh, sh
     source                        csh
     stop                          csh, ksh, sh
     suspend                     | csh, ksh, sh
     switch                      | csh
     test                        | ksh, sh
     time                        | csh
     times                       | ksh, sh
     trap                        | ksh, sh
     type                        | ksh, sh
     typeset                     | ksh
     ulimit                      | ksh, sh
     umask                       | csh, ksh, sh
     unalias                     | csh, ksh
     unhash                      |  csh
     unlimit                     | csh
     unset                       | csh, ksh, sh
     unsetenv                    | csh
     until                       | ksh, sh
     wait                        | csh, ksh, sh
     whence                      | ksh
     while                       | sh, ksh, sh


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?199906211140.HAA05809>