Add binary_not_exists to shell-functions
This commit is contained in:
parent
395986145b
commit
6762762669
1 changed files with 19 additions and 1 deletions
|
|
@ -21,4 +21,22 @@ function print_info_sub_noisy { [ ${NOISY:-0} -ge $1 ] && print_info_sub $@[2,-1
|
|||
function print_error_sub_noisy { [ ${NOISY:-0} -ge $1 ] && print_error_sub $@[2,-1] }
|
||||
|
||||
# Return 1 if the binary exists (according to hash); 0 otherwise.
|
||||
function binary_exists { return $(hash $1 1>/dev/null 2>&1) }
|
||||
function binary_exists {
|
||||
hash $1 &>/dev/null
|
||||
if [[ $? ]]; then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
# Return 1 if the binary doesn't exist (according to hash); 0 otherwise. See
|
||||
# binary_exists.
|
||||
function binary_not_exists {
|
||||
binary_exists $1 &>/dev/null
|
||||
if [[ $? ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue