The extension is completely irrelevant. With very few exceptions (such as gzip
), extensions are optional and arbitrary on *nix systems. A shell script doesn't need an extension and any extension it may have carries absolutely no meaning. You could call a bash script foo.asldifjh
and it would work in exactly the same way as foo.sh
.
So, to answer your question, for all the shells you mentioned, the extension is irrelevant and all of them can launch a script with shellName /path/to/script
. All of them can also use a shebang line. Here's one for ksh
for example:
#! /bin/ksh
If the script file has a shebang line and is set to executable (chmod a+x /path/to/script
), you can simply run /path/to/script
directly and the script will be interpreted by whatever shell you have in the shebang line. Again, the extension is completely irrelevant.
#!
-line on line 1 of the script (if the file is executable). The filename is unimportant. You should not need to specify an explicit interpreter on the command line at all. I'm uncertain about the context to the question, so I don't know what is actually sought. – Kusalananda Nov 15 '21 at 11:01#!
-line also known as 'shebang' line. – sudodus Nov 15 '21 at 11:06