#!/bin/sh
Alpha=`df -h |grep "//10.12.8.106/Version/EMS/EMS_Embedded/Alpha"`
#如果Alpha为空,就执行挂载磁盘命令
#如果Aplha存在就不执行后面的命令
#只有在 && 左边的命令返回真(命令返回值 $? == 0),&& 右边的命令才会被执行。
[ -z $Alpha ] && mount -t cifs //10.12.8.106/Version/EMS/EMS_Embedded/Alpha /opt/goldwind/ShareFolder/ -o username=zhanghongyu41031@goldwind.com,password=Haishui163,gid=0,uid=0,dir_mode=0777,file_mode=0777
#方便看但不够简洁的写法
Alpha=`df -h |grep "//10.12.8.106/Version/EMS/EMS_Embedded/Alpha"`
if [ -z $Alpha ]
then
mount -t cifs //10.12.8.106/Version/EMS/EMS_Embedded/Alpha /opt/goldwind/ShareFolder/ -o username=zhanghongyu41031@goldwind.com,password=Haishui163,gid=0,uid=0,dir_mode=0777,file_mode=0777
else
break
fi