bash shell 腳本的方法有多種,現在作個小結。假設我們編寫好的shell腳本的文件名為hello.sh,文件位置在/data/shell目錄中并已有執行權限。
方法一:切換到shell腳本所在的目錄(此時,稱為工作目錄)執行shell腳本:
./hello.sh
方法二:以絕對路徑的方式去執行bash shell腳本:
bash hello.sh
sh hello.sh
方法四:在當前的shell環境中執行bash shell腳本:
. hello.sh
source hello.sh
新聞熱點
疑難解答