I created basic script in Windows.
#!/bin/bash
echo Hello
I am using Cmder, ConEmu derivative. I tried to change the priviliges with chmod, but they are the same. I don't know how can I execute this script. Normal Linux way, which is: ./hello.sh does not work, and typing just hello.sh makes Windows try to open it, which is bad, since I want it in console. How to execute this script in ConEmu/Cmder?
You can put your own
.sh
files into$CMDER_ROOT/config/profile.d/*.sh
directory, as the docs explain hereIt works just like on Unix shells
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:Or you can source a script inside your
.bashrc
and make it available through a function:where the script is:
I've noticed you can run
bash
from cmder. So I could do it like:or simpler
Disclaimer: New to cmder (just downloaded it) and Linux myself.
If you don't have time jump to The conclusion below:
TL:DR: Here my toying with "Cmder > bash" on Windows to create a Global script:
I've created a external script:
with the content
it can be executed from the same folder:
on creating a simbolink link:
it seems to work fine calling it with just the name:
but if the original file gets modified:
the changes are not reflected using the link:
The conclusion:
so the best option is creating the script directly on the folder /bin:
and
#!/bin/bash
isn't even necessary with Cmder on Windows, and it gets executed successfully from everywhere in the Cmder bash:On my own instance of Cmder,
bash [filename]
works just fine, and I believe much simpler: