|We don't bite newbies here... much|
Re: Unix shell versus Perlby peterdragon (Beadle)
|on Feb 18, 2008 at 23:44 UTC||Need Help??|
I've pretty much given up writing shell scripts longer than 20 lines.
The main reason is error handling. Exceptions, warnings, controlled failures? Forget all that in shell script, one bad error and it fails, no warning, no log.
A secondary reason is portability. Let's take "echo". Depending whether you're on Solaris or AIX or Linux my guess is you're wondering whether to run /bin/echo or builtin echo or echo -e or whatever to get a \n translated to carriage return. Have you ever looked at the shell script behind GNU configure? That says it all, and what it's saying is "should have been written in Perl!".
Okay, backaways when you might have perl4 or perl5.05 or perl 5.06 out of the box with your distro it made sense to use shell for more portability. Since the advent of perl 5.06 the language has been stable enough (more so than sh/csh+Unix of choice) to be preferable.