/ Published in: Bash

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/bin/bash # POSIX command lookup example CMDS="tar /usr/bin/mysqldump /path/to/other/command" for i in $CMDS do # command -v will return >0 when the $i is not found command -v $i >/dev/null && continue || { echo "$i command not found."; exit 1; } done
URL: http://www.cyberciti.biz/faq/unix-linux-shell-find-out-posixcommand-exists-or-not/
Comments
