On Sun, 2014-10-12 at 22:05 +0200, Florian Weimer wrote: > Array variables practically imply arithmetic evaluation, amd this is a > shell feature which is rather difficult to use correctly because > compatibility with other shell encourages both recursive evaluation > and access to the full shell language in a few corners. I don't understand this. I've had legions of bugs in shell scripts over the years. The number caused by arithmetic evaluation is tiny. The only trap I can recall is it being restricted to 32 bit signed arithmetic, and that not being enough for times. > If you need array variables, it's likely that the script has grown so > complex that switching to another language is a good idea. Not really. One of, if not the primary function of the shell is to run other programs. One of the things you have to do when running programs is construct and process argument lists. An array variable is the only sane way to represent an argument list in the shell scripting language. The only other option is horrid hacks using `eval ...`. Also, while I agree that shell script is a terrible language and nothing over 100 lines or so should be written in it, real life doesn't always pan out the way you plan. It's probably true that any shell script I've written started out under 100 lines, or at least I'm going to pretend I thought they would would when I stared writing them. But the things are like dust bunnies in a cupboard. They grow while you aren't paying attention. So now I have one 5000 line shell script, and a few around the 1000 line mark. No, this is not something I'm proud of, but I've got better things to do in my life than rewrite 5000 line programs that have been bug free for years.
Description: This is a digitally signed message part