依赖软件安装
一、判断软件是否安装
#!/bin/bash
softwareName=python
function isInstalled(){
if ! type $softwareName >/dev/null 2>&1; then
echo 'software未安装';
return 0
else
echo 'software已安装';
return 1
fi
}
isInstalled $softwareName
if [ $? -eq 1 ];then
echo 'is installed';
else
echo 'not installed';
fi
二、安装出错后自动重新安装
while [ 0 -eq 0 ]
do
echo ".................. job begin ..................."
# ...... call your command here 在这里调用你的命令 ......
# check and retry
if [ $? -eq 0 ]; then
echo "--------------- job complete ---------------"
break;
else
echo "...............error occur, retry in 2 seconds .........."
sleep 2
fi
done