Werden wir Helden für einen Tag

Home | About | Archive

On Shell Script

Posted on Nov 28, 2012 by Chung-hong Chan

Recently, I have inherited with a shit load of legacy shell scripts written by a previous worker and the bad news is I need to maintain them. I don't like bash for a number of reasons. First, the syntax is crazy. Crazier than R or Perl. Can anyone tell me why we need to declare a variable with a=13 and then we need to call it with $a? ((and we also have ${a})) I don't get it at all. Second, I hate the fact that we need to use multiple pipes to do simple thing. For example, to test if a text file is empty, I need to ((for predicate, we also have single square brackets and double square brackets! Enjoy!))

if [`wc -l somefile.txt | cut -d" " -f1` -gt 0]

A process like this is error-prone and I will not consider a shell script with these constructs as production ready. More like a kludge.

Powered by Jekyll and profdr theme, a fork of true minimal theme