linux執行檔案命令

來源:趣味經驗館 2.66W

linux系統下執行檔案命令是:./test.sh。

1、cd /test ./test.sh ./表示在當前目錄

2、/test/test.sh 以絕對路徑去執行。

3、cd /test bash test.sh 或者 sh test.sh 該命令是將test.sh作為引數傳給sh(bash)命令來執行的。

4、cd /test. test.sh 或者 source test.sh

注意:前三種方法是在父shell(當前shell)開啟一個子shell環境,然後在子shell環境中執行,執行完,子shell環境關閉,然後回到父shell,第四種是在父shell中執行的。

linux執行檔案命令

熱門標籤