1. 14
  1.  

  2. 7

    It seems that recently Dylan has disappeared off the radar, I don’t know what the situation is but I wish him well.

    He was burnt out; it has happened several times, though he’s never gone this far before. But don’t worry, he’s been back for a while and is doing well now, resuming his normal activities.

    Why is printf used here, and not the arguably simpler echo?

    Adding on to what you mentioned, echo is hairy and cannot output a variable robustly. For example, try var="-n"; echo "$var".

    There is no way to turn off interpretation of option arguments—echo does not support -- unlike pretty much everything else. It’s just overall a mess and thus, many shell programmers just use printf no matter what the situation. It’s everything echo is not.

    In any case, while it’s clear what this is and how it works, it remains to me somewhat of a mystery as to why the particular instance used in the main function here works, where all three expressions are null ((;;)).

    It’s nothing Bash-specific; it’s just how a C-style for loop works. As the comment hints at, it was the de-facto construct for infinite loops in C, before while (true) even existed. Vintage!

    1. 4

      i still use for (;;) in homage.

      1. 1

        A good reason to use specific syntax, in my book.

      2. 1

        Lovely, thanks for the insights!

      3. 2

        Excellent post! I absolutely love writing bash—you can do some very golfy stuff with it. I’ve written shlide, a pure bash presentation tool. There’s a lot of funky shit in there, that you might find interesting.

        1. 3

          Used this for a few presentations during my internship, excellent tool! You can get very creative with shlide and a Quake-style terminal, my code demos turned out awfully smooth. :)

          1. 1

            That’s awesome to hear. ;)

          2. 1

            Fab, definitely going to check it out, the name has me hooked already! :)