Bash Centos7 "which" command
Instead of which
command you can use type
command.
type grep > /dev/null 2> /dev/null
if test "$?" != "0"
then
echo "\"grep\" command not found."
echo "Installation is aborted."
exit 1
fi
To find a package in CentOS, use yum whatprovides
:
yum whatprovides *bin/which
In this particular case, the package is called which
, so
yum install which
should pull it in.