我知道这可能是一个愚蠢的问题,但我安装了一个Centos-7最小化服务器,并且缺少"which"命令。 我有一个需要它的脚本,但我无法找到安装它的yum包。 下面的代码来自一个make文件。
which grep > /dev/null 2> /dev/null
if test "$?" != "0"
then
echo "\"grep\" command not found."
echo "Installation is aborted."
exit 1
fi
非常感谢您的帮助,这个问题很难在Google上找到答案。
grep
或which
缺失吗? - Odiif ! type -p grep >/dev/null 2>&1; then echo "grep not found, installation aborted" >&2; fi
。 - tripleeemake
和which
,所以感谢你的提问。@Wintermute的回答对我很有启发。 - jgreve