The Woodshed

Behind here, no one can hear you scream

Bashing The Basher

A rebuttal

I disagree with this article. (Specifically, the Bash suggestion—SQLite is cool.)

Let’s start off with some bullet points.

  • Bash might come “preinstalled on your Mac,” but it doesn’t with Windows (not fair to simply ignore the huge amount of people who use Windows), and it’s actually not even the default shell on many Linux distros (last I checked, Ubuntu uses Dash, for example, though it does come with a Bash binary).
  • There is a surprising amount of differences in supported features between Bash versions. It definitely shouldn’t be viewed as some kind of panacea of portability (and in fact neckbeards recommend trying to stick with #!/bin/sh if you can, if you have an interest in writing portable shell scripts).
  • His points about “learning a little at a time” can largely apply to, say, JavaScript (and in fact that’s how a lot of people learn JS)…
  • …But I don’t necessarily agree with that approach anyway. He talks about not realizing Bash supported arrays for 2 years as if that were a good thing; to me that is saying, “I wasted time doing things in a suboptimal way for 2 years.”
  • Bash is full of unintuitive, surprising semantics, not to mention syntax so ugly that it makes Perl blush. For example, if you want to do simple arithmetic, you better enclose it within the right construct (namely the $(( )) stuff), or it’s not going to work right. Same goes for things like comparing variables, text substitution, the list goes on and on. Seriously, just try reading Bash’s manual someday; you’ll quickly realize it’s not there to hold your hand.

I think what he’s trying to say is, it’s nice to be able to see results fast. And that’s fine, but I think you can see just as many results just as quickly from learning a little JS+jQuery (and hell, someone might actually pay you for it… good luck selling your crazyass “Bash+SQLite Application”). Granted, JS has its share of pitfalls too, and I wouldn’t necessarily pick it for a beginner’s first language, but it’s a lot more sensible than Bash.

I think the choice of first language depends on the person. Are we talking about someone who has aspirations to work as a professional developer? A casual hobbyist? Someone in a computery field (sysadmin, web designer, et al.) who wants to automate something or supplement their work? Someone who is interested in scripting a particular application, but doesn’t care about programming outside that?

In any case, I wouldn’t name “Bash” as my choice for any of those people. If “it depends” isn’t a good enough answer, my generic response is probably Python. My pick for the “smallest/cleanest” category actually goes to Lua, but its (albeit intentionally) limited number of out-of-the-box libraries really only make it suitable for beginners who can use it in a preexisting scripting environment (World of Warcraft is one such). Thus Python, even though I don’t care to use it for my own projects, is probably the closest thing to “sane” among the superpopular languages (which thus have a large ecosystem of learning resources, libraries, etc.) I know that’s not as exciting as boldly recommending a crufty shell scripting language, but people don’t come to this blog to be excited. (They come because I send them a link.)