How to run a shell script on a Unix console or Mac terminal?

前端 未结 7 1067
执念已碎
执念已碎 2020-11-28 16:54

I know it, forget it and relearn it again. Time to write it down.

7条回答
  •  北海茫月
    2020-11-28 17:45

    To start the shell-script 'file.sh':

    sh file.sh
    
    bash file.sh
    

    Another option is set executable permission using chmod command:

    chmod +x file.sh
    

    Now run .sh file as follows:

    ./file.sh
    

提交回复
热议问题