I've written a ridiculous amount of shell script in my day, especially when doing "devops" before we had a term like "devops" to describe it. I've fallen in almost every pit bash has. With that background, here is my opinion. 1. This article contains excellent advice and should be starred for later retrieval. 2. Having basic scripting skills will make you a way better programmer. Many times I've done huge refactors a…
What is your opinion on using other languages to augment bash? Awk, perl etc.
some_command \
| grep -E 'some.*regex$' \
| sed -e 's/erase_text//g' \
| sed -e 's/erase_more//g' \
| awk '{ print $2 }' \
| cut -d ':' -f 1
I used to reach for Perl one-liners a lot, and still do sometimes when I need a gross regex that `sed -E` can't handle (See Perl Pie[1]), but Ruby has been making an appearance more and more often for handy one-liners. Roblog has a great post on using Ruby [2].If the script is complex enough and I'm willing to take a dependency on Ruby, that is usually where I turn. Where that line is does change from time to time. Ruby makes it super trivial to call shell commands and process them easily as well, which makes it easy to integrate into existing scripting [3].
Hopefully that answered your question :-)
[1] http://technosophos.com/2009/05/21/perl-pie-if-you-only-lear...