executing shell script without calling sh implicitly

后端 未结 5 1165
夕颜
夕颜 2021-02-01 18:05

I was wondering if it is possible to make a \"link\" in usr/bin (i.e.) that leads to a shell-script.

But I want just to write

% shellscript
5条回答
  •  灰色年华
    2021-02-01 18:45

    In addition to making the script executable and linking it into /usr/bin, as others have suggested, you will also want to add the "shebang" line to the top of the script:

    #!/bin/sh
    
    # your commands here
    

    This lets you specify which shell interpreter (bash, bourne shell, c-shell, perl, python...) should be used to execute your script.

提交回复
热议问题