Bash Launchers
From Zanecorpwiki
A "bash launcher" simply means putting some bash-based front-end logic in front of another script. This is typically done because launching the fronted script directly is difficult while running a bash script is as simple as can be. Sometimes, there's some amount of work to be done that's easier in bash.
Personally, I'm familiar with bash argument processing and find it as elegant as any other. Even if one could argue that some language's argument processing support is significantly better, there's still the advantage that if you know the bash method, then you can use it and avoid the expense of learning yet another way of doing things.
Bash launchers are done just like self installing packages, only instead of an archived payload, the script to be launched is the payload:
PERL_START=`cat $0 | awk '/^__PERL_FOLLOWS__/ { print NR }'`
tail +$PERL_START $0 | perl
Where perl can be be replaced with ruby, php, etc. I use this a lot with gimp scripts (written in scheme): gimp -i -b.


