Cmder bash script executing

后端 未结 6 1066
太阳男子
太阳男子 2021-02-13 05:35

I created basic script in Windows.

#!/bin/bash

echo Hello

I am using Cmder, ConEmu derivative. I tried to change the priviliges with chmod, bu

6条回答
  •  北恋
    北恋 (楼主)
    2021-02-13 05:57

    If you want to be able to run the script by simply typing its name, a workaround is to create an alias and put it into your .bashrc such as:

    alias scriptName="bash /pathToTheScript/yourScript.sh"
    

    Or you can source a script inside your .bashrc and make it available through a function:

    source /pathToTheScript/yourScript.sh
    

    where the script is:

    #!/bin/bash
    function your_function()
    {
    yourCode
    }
    

提交回复
热议问题