Inside every long shell script is a much simpler perl script waiting to get out. (some of my friends would say python or ruby instead, but the idea is the same). The recent changes to pg_indent that Bruce based on my work make it much simpler, and today I reached the stage where I decided to stop monkeying with the small script I use to set up builds of Postgres for development/testing and replace it with a much simpler perl script. It might take an hour to do but it will repay that very quickly.
I didn't say it made it shorter <img src="/andrew/templates/default/img/emoticons/smile.png" alt=":-)" style="display: inline; vertical-align: bottom;" class="emoticon" /> Sometimes you can make things shorter but a whole lot less simple. <br />
I find that the longer a shell script gets the more you need to look for hackish ways to get what you want. Beyond a handful of lines I find switching to Perl a lot better, as it gives me much better tools for more complex tasks.
> Sometimes you can make things shorter but a whole lot less simple. <br />
Amen. Not to mention you can go overboard and make things simple on a detail level at the cost of making things more complex in the grand scheme. A verbose Perl script vs. a shell script consisting of simple constructs put together in a convoluted manner is a nice example of this.