In Windows CMD I can write some DOS commands in a text file, with *.bat
extension, then just calling the file name will execute the commands.
cd c:\myapp
dir
Saving the above file, for example, m.bat
will make it executable by entering m
in the command prompt.
In Linux I tried to wrap the command service network-manager restart
in a .sh
file named rn.sh
after changing its mode chmod +x rn.sh
to be executable I always have to enter ./rn.sh
to run it.
However, I just need to enter rn
to run it. In other words, I need that rn.sh
file works like a program or an application. How could I do that?
mv rn.sh rn
and it will still work. But for the original script, it is better to just use alias. – Alvin Liang Nov 21 '18 at 03:54~/bin
as you described and it works as a breeze! – SaidbakR Nov 21 '18 at 19:00