Ahh, yes ... the "BASH script." A simple scripting language that was built into a popular Unix/Linux shell that was never really intended to have one.
(The only shell that I know of which was 'intended to have one' was Dr. Korn's shell, ksh, which implements a very impressive (for its time ...) built-in language that very few people today actually use.)
A disturbing number of scripts still use "bash scripting," and a disturbing number of computer programmers still think that they are
limited to this. They are not. Shells provide a far more powerful feature: colloquially known as
"shebang." Written as:
#!.
If the
first line of your script begins with – for example –
#!/usr/bin/perl – then the shell will silently pass control over to [Perl] to handle the remainder of the script. And the user will never know.
"Perl ... PHP ... Ruby ... pick your oyster."
(Strictly speaking,
any executable file can be used here.)
This concept was further enhanced by the
env command, which is specifically intended to be used on a "shebang" line to add further goodness to it ... such as, among other things, "automatically discovering where [Perl] is on this machine." It also takes care of a few other things that the shell by itself doesn't do as well.
I now refer you to
man env (and,
man bash) for further details.
So ... keep this in mind. Most Linux distros routinely install several of these language interpreters, and most of a vendor's built-in commands and scripts use one or more of them. Therefore, you do
not have to resort to "computer calisthenics" to create a perfectly-functional "command-line command." You are
not limited to bash's built-in but very limited facilities. Full-featured programming environments, which were
designed to be so, are at your beck and call when writing any command-line script.
(Incidentally, this is exactly the reason why many programming languages today use the # character in column-one to denote a comment line.)