snipplets.dev/code/Bash/command_exists.sh

15 lines
214 B
Bash
Raw Normal View History

2022-08-13 11:50:44 +03:00
#!/bin/bash
if ! [ -x "$(command -v git)" ]; then
echo 'Error: git is not installed.' >&2
exit 1
fi
2023-09-10 01:13:40 +03:00
# OR
2022-08-13 11:50:44 +03:00
if ! command -v crystal &> /dev/null
then
echo "<the_command> could not be found"
exit
fi