windows下如何運行shell腳本
1、安裝 git
官網:https://git-scm.com/
下載安裝即可
2、打開git bash
3、進入工作目錄
75377@DESKTOP-1N42TVH MINGW64 ~ $ pwd ## 查看當前目錄 /c/Users/75377 75377@DESKTOP-1N42TVH MINGW64 ~ $ cd C:/Users/75377/Desktop/test ## 切換目錄,注意是反斜杠 75377@DESKTOP-1N42TVH MINGW64 ~/Desktop/test $ pwd /c/Users/75377/Desktop/test 75377@DESKTOP-1N42TVH MINGW64 ~/Desktop/test
4、測試
75377@DESKTOP-1N42TVH MINGW64 ~/Desktop/test $ ls test.sh* 75377@DESKTOP-1N42TVH MINGW64 ~/Desktop/test $ cat test.sh ## 測試腳本, 直接用vim創建即可 #!/bin/bash echo "hello world!" 75377@DESKTOP-1N42TVH MINGW64 ~/Desktop/test $ bash test.sh ## 直接bash運行, 輸出運行結果 hello world! 75377@DESKTOP-1N42TVH MINGW64 ~/Desktop/test