方法一if ! [ -x "$(command -v git)" ]; then echo 'Error: git is not installed.' >&2 exit 1 fi方法二[[ -f /usr/bin/wget ]] || { yum install wget -y; } Linux