Add "exists" to check for command in scripts
This commit is contained in:
parent
86f4216cde
commit
0b1b1344d7
|
@ -22,12 +22,16 @@ succeed() { result $c_success $@ }
|
|||
error() { echo -n " "; fail $@ }
|
||||
warning() { echo -n " "; warn $@ }
|
||||
|
||||
exists() {
|
||||
type "$1" &>/dev/null
|
||||
}
|
||||
|
||||
depend() {
|
||||
local missing
|
||||
local i
|
||||
|
||||
for i in "$@"; do
|
||||
type "$i" &>/dev/null || {
|
||||
exists "$i" || {
|
||||
echo >&2 " $c_fail Missing dependency: $i. Please install it"
|
||||
missing=1
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue