bash: check command exists
This commit is contained in:
parent
c01cbe5914
commit
920faf284d
12
~/Bash/command_exists.sh
Normal file
12
~/Bash/command_exists.sh
Normal file
@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
if ! [ -x "$(command -v git)" ]; then
|
||||
echo 'Error: git is not installed.' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v crystal &> /dev/null
|
||||
then
|
||||
echo "<the_command> could not be found"
|
||||
exit
|
||||
fi
|
Loading…
Reference in New Issue
Block a user