1 #!/bin/bash
2
3 while true
4 do
5 #res1= $(mount1)
6 echo '1' | sudo -S mount -t cifs //192.168.0.70/ssd/ /mnt/share -o use rname='root',password='root'
7 res2=`echo $?`# $? 表示上个命令是否执行完毕
8 echo $res2
9 if [ $res2 == 0 ]; then
10
11 echo "mount suceeded"
12 break
13 else
14 echo "mount faild"
15 continue
16 fi
17 done
~
shell 文件开启
#!/bin/bash
function func1(){
# 在$()的圆括号中可以执行linux命令,当然也包括执行函数
# 变量res2将会接收函数的返回值,这里是3
if [[ $res2 == 3 ]]; then
Guess you like
Origin blog.csdn.net/qq_51609636/article/details/120027565
Recommended
Ranking