[BusyBox] overriding builtins

David Douthitt ssrat at mailbag.com
Fri Nov 17 15:01:02 UTC 2000


On 17 Nov 2000, at 9:07, Tomi Ollila wrote:

> Thursday Nov 16 16:35:30 -0800 2000 Larry Doolittle <ldoolitt at recycle.lbl.gov> wrote:

> I'm reading throught zsh manual page (zshall and searching for `builtin')
> to check how zsh can be forced to execute external command instead of a
> builtin if one exists. So far I've found one:
> 
>      command
>           The command word is taken to be the name of an external
>           command, rather than a shell function or builtin.
> 
> i.e. `command echo foo' will use external echo.

ksh (really pdksh) has this:

       command [-pvV] cmd [arg1 ...]
              If neither the -v nor -V options are given, cmd  is
              executed  exactly  as  if  the command had not been
              specified, with two exceptions: first,  cmd  cannot
              be  a  shell function, and second, special built-in
              commands lose their specialness (i.e.,  redirection
              and  utility errors do not cause the shell to exit,
              and command assignments are not permanent).  If the
              -p  option  is given, a default search path is used
              instead of the current value of  PATH  (the  actual
              value  of  the default path is system dependent: on
              POSIXish systems, it is the value returned by
                                getconf CS_PATH
              ).

              If the -v option is  given,  instead  of  executing
              cmd,  information  about  what would be executed is
              given (and the same is done for arg1 ...): for spe­
              cial  and  regular built-in commands and functions,
              their names are simply printed, for aliases, a com­
              mand that defines them is printed, and for commands
              found by searching the  PATH  parameter,  the  full
              path  of  the command is printed.  If no command is
              be found, (i.e., the path search fails), nothing is
              printed  and  command exits with a non-zero status.
              The -V option is like the -v option, except  it  is
              more verbose.

Bash says this:

       command [-pVv] command [arg ...]
              Run command with args suppressing the normal  shell
              function  lookup. Only builtin commands or commands
              found in the PATH are executed.  If the  -p  option
              is given, the search for command is performed using
              a default value for PATH that is guaranteed to find
              all of the standard utilities.  If either the -V or
              -v option is supplied, a description of command  is
              printed.   The -v option causes a single word indi­
              cating the command or file name used to invoke com­
              mand  to  be printed; the -V option produces a more
              verbose description.  If the -V  or  -v  option  is
              supplied,  the  exit  status  is  0  if command was
              found, and 1 if not.  If neither option is supplied
              and  an  error occurred or command cannot be found,
              the exit status is 127.  Otherwise, the exit status
              of  the  command builtin is the exit status of com­
              mand.

Just FYI....

Perhaps we should consider a new command for busybox: "command" ?

What ever happened to "env"?


-- 
David Douthitt
UNIX Systems Administrator
HP-UX, Linux, Unixware
ddouthitt at mennonite.minister.net





More information about the busybox mailing list