bash vs perlby leocharre (Priest)
|on Jan 11, 2008 at 11:16 UTC||Need Help??|
leocharre has asked for the
wisdom of the Perl Monks concerning the following question:
Sometimes I code little scripts that do stuff, maybe i let them take arguments via the command line. Most of the calls end up being system calls, I use perl because .. Kinda feels right, checking the parameters passed in, etc etc.
I was considering that maybe I should look into just writing plain old bash for some of these.. So, how do we take parameters in bash.. aha.. simple enough, $1, $2, $3 are the positions of the arguments passed in broken up by spaces.
What if you want to use dash flag, like 'command -o val'
I thought.. this should be easy enough. And oh boy... Compared to perl's Getopt::Std.. . is bash getopts as much of an increible pain in the * as it looks like to be?? It's excruciating!
It seems that by comparison, bash is great if you know exactly what is going to happen, like, if you want to search your hard drive for empty directories and delete them- but if you want to do anything more intricate- you're looking for pain and anguish... My experience with bash is limited, so I may be having early rejection feelings.
Should one press on to experience it, getting more involved with bash then simple scripts?