Wanna see this logo while booting your 2.6 kernel? Click here!

19.04.2005 11:10

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:
# 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

case $1 in
        which $2
        if which $2 >/dev/null 2>&1; then
          echo $2 is $(which $2)
          echo "command: $2: not found"
          exit 1
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!