Menu

Home

Oleksii Cherniavskyi

Description

cmdok checks that specified commands are OK. If command is OK than it exists in PATH and can be run.
It is a simple, small and portable Bash script. It is useful in software packages that want to check that some commands exist before trying to run them.

Example

$ cmdok gcc
checking gcc ... OK

$ cmdok install tar gzip ar clang
checking install ... OK
checking tar ... OK
checking gzip ... OK
checking ar ... OK
checking clang ... OK

cmdok retruns '0' on success. It can be used in scripts that check commands before running them. Example:

if cmdok -f install; then
  install ...
else
  exit 1
fi

Usage

cmdok [OPTIONS] <command>..

Options:
  -n             disable printing any status
  -f             print status only on fail
  -v             display version information and exit
  <command>..    commands to check