Add existing scripts
This commit is contained in:
1 parent
2ab5a42c2b
commit
3c05d74104
31 files changed
+1138
No files matched your search
@@ -0,0 +1,23 @@
|
||||
# To have scripts not write everything out to stdout so results can be captured
|
||||
# redirect any output not wanted to /dev/null
|
||||
#
|
||||
# This is the original that outputs 1 or 0 with echo
|
||||
command_exists_1 () {
|
||||
if type "$1" >> /dev/null; then
|
||||
echo "1"
|
||||
else
|
||||
echo "0"
|
||||
fi
|
||||
}
|
||||
|
||||
# A better version is to use the return keyword
|
||||
# This command can be used in an if statement, if needed
|
||||
# The logic has to be reversed - the shell treats 0 as success
|
||||
command_exists() {
|
||||
if type "$1" >> /dev/null; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user