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

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

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

7条回答
  •  孤街浪徒
    2020-11-28 17:35

    Little addition, to run an interpreter from the same folder, still using #!hashbang in scripts.

    As example a php7.2 executable copied from /usr/bin is in a folder along a hello script.

    #!./php7.2
    

    To run it:

    ./hello
    

    Which behave just as equal as:

    ./php7.2 hello
    

    The proper solutions with good documentation can be the tools linuxdeploy and/or appimage, this is using this method under the hood.

提交回复
热议问题