The gist of article seems to be that for many tasks people should combine the powerful Unix standard commands like find, grep, xargs, sed, etc instead of writing dedicated programs in lower level languages such as Ruby, Python, Java etc. This idea is not new, and many of the people around here have heard it 15 or more years ago. Being a developer, I always liked the perspective of having to write lesser code.
However, the Unix command line and shell script approach never really worked for me, especially if other people in the team wrote them. The main reasons for that are:
- missing error handling (no checking for "$?", broken pipes, ...)
- lack of consideration for special cases such as file names with blanks in them
- difficult post-mortem analysis if the data causing an error got lost in a pipe instead of being available in an intermediate or temporary file
- possible configuration nightmare to get non-ASCII characters working (depending on the actual platform you're on; it can be easy, too)
- terse syntax with a tendency to "write only" code (which makes sense for a direct input command line but less so for code that should be maintained for years to come)
All of this could be overcome by measures such as checking $?, redirecting stderr, using temporary files, configuring encodings properly, documentation comments and so on. However, this rarely ever happens in practice.
For the past couple of years I have been using ant for many tasks formerly delegated to shell scripts. Its main advantages are:
- provides many standard tasks to copy/move/delete files, search and replace in files, filter files, download files, send mails etc.
- provides many ways to limit commands only to certain files depending on name, date, contents etc.
- most tasks fail on encountering any error and consequently terminate the whole script (though this can be disabled for a certain task if needed be)
- generic <exec> task to execute shell commands in case ant does not provide a standard task; you have to be careful with this one though and set failonerror="true" or it will continue even if it fails
- pretty legible due to using english words instead of abbreviations for most things
- many simple typos are already detected when ant parses your script and not only when a task gets executed.
- platform independent syntax for file paths so your script can work on Unix and Windows.
- takes care of all escaping and non-ASCII issues with files names.
Of course it's not perfect. For example, it uses XML and consequently contains some syntactic noise, it lacks advanced string operations, there are no pipes and sometimes seemingly trivial things result in a lot of messing around with properties. Nevertheless I rarely see a need to write shell scripts anymore except for simple launchers.
YMMV but despite ant initially being a build tool for Java developers, we use it for many sysadmin-like tasks with great success and a small amount of development time.