Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

check if a command exists

# To find out if a given command exists:

if command -v given-command > /dev/null 2>&1; then
  echo given-command is available
else
  echo given-command is not available
fi
Source by unix.stackexchange.com #
 
PREVIOUS NEXT
Tagged: #check #command #exists
ADD COMMENT
Topic
Name
7+3 =