programs.sh
1.05 KB
##
# get and export the locations of used programs and export them
# I assume that on every UNIX/shell variant at least [ is globally
# available. I will use it throughout all other scripts without
# checking for existence.
# I also assume through all scripts that eval is available.
#
[ -z "${WHICH}" ] && WHICH="/usr/bin/which"
[ -z "${UNAME}" ] && UNAME="$(${WHICH} uname)"
[ -z "${GREP}" ] && GREP="$(${WHICH} grep)"
[ -z "${AWK}" ] && AWK="$(${WHICH} awk)"
[ -z "${SED}" ] && SED="$(${WHICH} sed)"
[ -z "${ECHO}" ] && ECHO="$(${WHICH} echo)"
[ -z "${SORT}" ] && SORT="$(${WHICH} sort)"
[ -z "${TR}" ] && TR="$(${WHICH} tr)"
[ -z "${PRINTF}" ] && PRINTF="$(${WHICH} printf)"
[ -z "${LOGGER}" ] && LOGGER="$(${WHICH} logger)"
[ -z "${NPROC}" ] && NPROC="$(${WHICH} nproc)"
[ -z "${LSCPU}" ] && LSCPU="$(${WHICH} lscpu)"
[ -z "${IP}" ] && IP="$(${WHICH} ip)"
[ -z "${IFCONFIG}" ] && IFCONFIG="$(${WHICH} ifconfig)"
export WHICH UNAME GREP AWK SED ECHO SORT TR PRINTF LOGGER NPROC LSCPU IP IFCONFIG
# vim: set ts=4 sw=4: