Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 3
    A case statement is far more readable than jamming it all into one line (which can end in catastrophe if the second command can fail, in this case, it is fine, but getting into that habit can be costly). This is the best method when dealing with cases like this. Commented Sep 20, 2013 at 9:02
  • I guess the case statement is the cleanest of the options presented, even if it isn't exactly what I was looking for. Oh well, Bash syntax is awkward, can't get around that. :) Commented Oct 7, 2013 at 18:52
  • 2
    @Jonik - that's been my finding as well. Believe me I've looked for alternatives, I prefer wide lines that do a lot rather than long programs, and the if/then/else is very verbose for my tastes too. Commented Oct 7, 2013 at 19:24