2021-07-29 00:37:35 -07:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
# YES_ZSH
|
2021-07-29 05:44:12 -07:00
|
|
|
# YES_BASH
|
|
|
|
# YES_DASH
|
2021-09-23 06:48:05 -07:00
|
|
|
# YES_ASH
|
2021-07-29 00:37:35 -07:00
|
|
|
|
2021-07-30 17:57:08 -07:00
|
|
|
has() { ### @-
|
|
|
|
### print the result of `which` if the program is found, else simply return 1.
|
|
|
|
###
|
2021-08-01 09:45:19 -07:00
|
|
|
### ```
|
|
|
|
### export CC="$(has clang || has clang-3.8 || has gcc)"
|
|
|
|
### ```
|
2021-07-29 00:37:35 -07:00
|
|
|
if [ -n "$ZSH_VERSION" ]; then
|
|
|
|
whence -p "$1"
|
|
|
|
else
|
|
|
|
which "$1" >/dev/null 2>&1 && which "$1"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-08-02 13:48:46 -07:00
|
|
|
[ -n "${preload+-}" ] || has "$@"
|