When I issue alias --help
I get this output:
alias: usage: alias [-p] [name[=value] ... ]
As I understand, all you need to do is to type an alias and provide the actual path to the script file, like this:
alias scr = /usr/local/tools/some_script.sh
However, I noticed that sometimes 2 paths are being provided when creating aliases - for example, I issued alias scr
command on a corporate machine and got this output:
alias scr = 'sudo /bin/sh /usr/local/tools/some_script.sh'
What is the purpose of introducing additional path /bin/sh
in this case?
The /bin/sh contains only a symlink to bash directory:
ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Aug 6 2017 /bin/sh -> bash
|
,;
or#
. Your question might be "why/bin/sh /usr/local/tools/some_script.sh
and not just/usr/local/tools/some_script.sh
?" The fact these strings may come from an alias is irrelevant. Don't think of an alias as of providing one or more paths. It provides a string. Upon further interpretation some substrings may turn out to be command(s) with options and/or (option-)arguments, possibly in form of paths.