How to use a shell script to check whether a command had been installed in the Linux server All In One
errors ❌
shell script error [: :需要整数表达式
shell script error [: -eq:需要一元表达式
shell script error [: ==:需要一元表达式
#!/usr/bin/env bash
if [[ $(command -v nvm) == nvm ]]; then
echo "❌ nvm not exist, trying to re-install it ... ⏳"
else
echo "nvm had been installed ✅"
fi
#!/usr/bin/env bash
temp=$(command -v nvm)
echo $temp
# if [[ $temp -eq nvm ]]; then
if [ $temp == nvm ]; then
echo "❌ nvm not exist, trying to re-install it ... ⏳"
else
echo "nvm had been installed ✅"
fi
echo finished
标签:profile,use,shell,script,--,echo,usr,nvm,root
From: https://www.cnblogs.com/xgqfrms/p/17721396.html