Same reason you don't put extensions on other commands. On linux systems, the command to list files is usually an ELF binary; but it's still named ls, not ls.elf, because the user running doesn't care or doesn't need to know what language was used to implement the command.
And what if you wrote a command, using sh, and named it foo.sh, but later realized it should rather be written in perl, then you have a problem. Do you keep the name as is, having now a perl script with a misleading .sh extension? or do you rename it to foo.pl and break everything that were relying on foo.sh?
And what if you wrote a command, using sh, and named it foo.sh, but later realized it should rather be written in perl, then you have a problem. Do you keep the name as is, having now a perl script with a misleading .sh extension? or do you rename it to foo.pl and break everything that were relying on foo.sh?
That is a lack of planning and not a reason for bad practice.
If you just started and then got to the point that it should be written in another language (e.g. because it is simpler or provides packages that do something for you) it doesn't matter, since the script shouldn't be used already (since it is not finished). If you need to add something new much later, that needs a rewrite of the script in another language then it is a lack of planning that you can't easily change the calls to the script.
If you need to add something new much later, that needs a rewrite of the script in another language then it is a lack of planning that you can't easily change the calls to the script.
That may be the case in whatever utopian world you live in, but in the real world needs change over time and a script may evolve in ways that could never have been foreseen and that may require reimplementation in a suitable language.
5
u/geirha Dec 02 '14
Don't put extensions on scripts. Especially not
.shwhen the script isn't even an sh script.