How do you run bash script as a command?

后端 未结 4 949
离开以前
离开以前 2021-01-22 10:53

I have a bash script, which I use for configuration of different parameters in text files in my wireless access media server.

The script is located in one directory, and

4条回答
  •  北荒
    北荒 (楼主)
    2021-01-22 11:31

    You can write a minimal wrapper in your home directory:

    #!/bin/bash
    exec /yourpath/yourfile.extension
    

    And run your child script with this command ./NameOfYourScript

    update: Unix hawks will probably say the first solution is a no-brainer because of the additional admin work it will load on you. Agreed, but on your requirements, my solution works :)

    Otherwise, you can use an alias; you will have to amend your .bashrc

    alias menu='bash /yourpath/menuScript.sh'
    

提交回复
热议问题