Small replacement script for the shell-builtin "command"
While trying to get my thinclient installation to work, I recognized that
Debian's "startx" command uses the shell builtin "command"
to check where the binary "deallocvt" is located.
This shell builtin is not available when using busybox v0.60. Of course I could
simply replace the command-call in startx with a call to "which", but
that would break my thinclient-creation script, so I wrote a simple command
replacement as shell script:
#!/bin/sh
#
# This script tries to replace the BASH-builtin "command" (according to
# the information I got from "man command".
#
# Some scripts (e.g. startx) rely on this builtin command
#
# by Alexander Griesser
# 2005-04-19
if [ $# -lt 1 ]; then
exit 0
fi
case $1 in
"-v")
which $2
;;
"-V")
if which $2 >/dev/null 2>&1; then
echo $2 is $(which $2)
else
echo "command: $2: not found"
exit 1
fi
;;
"-p")
shift
$*
;;
*)
$*
;;
esac
Name this script "command" (without the .sh extension) and place
it anywhere in your $PATH (I put it to /bin).
Update: As with version 1.0pre the command-builtin appeared in busybox, yeah!
Posted by Alexander Griesser
| Categories:
Busybox
| Comments:
--> New comment