亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区
Chinaunix
標(biāo)題:
怎樣交互式執(zhí)行已經(jīng)存在腳本
[打印本頁]
作者:
草_香
時(shí)間:
2013-06-13 19:37
標(biāo)題:
怎樣交互式執(zhí)行已經(jīng)存在腳本
剛開始學(xué)習(xí)shell知識(shí),想實(shí)現(xiàn)一個(gè)功能:
編寫腳本A.sh,執(zhí)行A.sh時(shí)交互出現(xiàn)1、2、3,選擇1的話執(zhí)行當(dāng)前已經(jīng)存在指定的1.sh,選擇2的話執(zhí)行當(dāng)前已經(jīng)存在指定的2.sh,選擇3的話執(zhí)行當(dāng)前已經(jīng)存在指定的4.sh,select可以實(shí)現(xiàn)這個(gè)功能么,不會(huì)寫,請(qǐng)問下各位怎么編寫A.sh可以實(shí)現(xiàn)這個(gè)功能啊,謝謝了~~:wink:
作者:
cao627
時(shí)間:
2013-06-13 21:16
#!/bin/bash
while echo "select a scrpt to run"
do
select script in "1.sh" "2.sh" "quit"
do
case $script in
"1.sh") sh 1.sh;;
"2.sh") sh 2.sh;;
"quit") exit 0;;
*) continue;;
esac
break
done
done
復(fù)制代碼
作者:
草_香
時(shí)間:
2013-06-14 09:43
回復(fù)
2#
cao627
謝謝了,我去試試去 你可以去百度一下我這個(gè)問題,我提了30分 我給你分,問題名稱:怎樣交互式執(zhí)行已經(jīng)存在腳本
作者:
mmwobuaini
時(shí)間:
2013-06-14 20:51
[root@localhost tmp]# cat 1.sh
#!/bin/sh
echo "it is 1.sh"
[root@localhost tmp]# cat 2.sh
#!/bin/sh
echo "it is 2.sh"
[root@localhost tmp]# cat 4.sh
#!/bin/sh
echo "it is 4.sh"
[root@localhost tmp]# cat A.sh
#!/bin/sh
echo -e "make your choice\n1 1.sh\n2 2.sh\n3 4.sh"
read i
case $i in
1)
/tmp/1.sh
;;
2)
/tmp/2.sh
;;
3)
/tmp/4.sh
;;
esac
[root@localhost tmp]# ./A.sh
make your choice
1 1.sh
2 2.sh
3 4.sh
2
it is 2.sh
復(fù)制代碼
希望能幫到你
歡迎光臨 Chinaunix (http://www.72891.cn/)
Powered by Discuz! X3.2