bin: Use `command` to check for commands
`command` is more idiomatic than `hash`. (Also, `hash` has side effects.)pull/4072/head
parent
8e8b75be6c
commit
a87a9bb63b
|
@ -1,5 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
is_cmd() { command -v "$@" >/dev/null 2>&1; }
|
||||
|
||||
# Move to the folder where ep-lite is installed
|
||||
cd $(dirname $0)
|
||||
|
||||
|
@ -9,19 +11,19 @@ if [ -d "../bin" ]; then
|
|||
fi
|
||||
|
||||
# Is wget installed?
|
||||
hash wget > /dev/null 2>&1 || {
|
||||
is_cmd wget || {
|
||||
echo "Please install wget" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Is zip installed?
|
||||
hash zip > /dev/null 2>&1 || {
|
||||
is_cmd zip || {
|
||||
echo "Please install zip" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Is zip installed?
|
||||
hash unzip > /dev/null 2>&1 || {
|
||||
is_cmd unzip || {
|
||||
echo "Please install unzip" >&2
|
||||
exit 1
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@ REQUIRED_NODE_MINOR=13
|
|||
REQUIRED_NPM_MAJOR=5
|
||||
REQUIRED_NPM_MINOR=5
|
||||
|
||||
is_cmd() { command -v "$@" >/dev/null 2>&1; }
|
||||
|
||||
require_minimal_version() {
|
||||
PROGRAM_LABEL="$1"
|
||||
VERSION_STRING="$2"
|
||||
|
@ -58,13 +60,13 @@ fi
|
|||
|
||||
# Is node installed?
|
||||
# Not checking io.js, default installation creates a symbolic link to node
|
||||
hash node > /dev/null 2>&1 || {
|
||||
is_cmd node || {
|
||||
echo "Please install node.js ( https://nodejs.org )" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Is npm installed?
|
||||
hash npm > /dev/null 2>&1 || {
|
||||
is_cmd npm || {
|
||||
echo "Please install npm ( https://npmjs.org )" >&2
|
||||
exit 1
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue