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*

12
  • Perfect, +1! I said they were not relevant because I did not want to go into that much detail. I wanted an answer that could work as a quick cheatsheet for newbies who're wondering what all the weird squiggles at the end of the various commands are. I did not mean to imply they're not useful. Thanks for adding all this. Commented Oct 6, 2014 at 18:07
  • 1
    I'm concerned about the "critical mass" problem -- if we post everything that we could possibly say about shells, we'll end up with our own TL;DR version of the Bash Reference Manual. Commented Oct 6, 2014 at 18:09
  • Also worth mentioning: Unlike in languages of the C family, ; by itself (or without a command preceding it) is a syntax error, and not an empty statement. Thus ; ; is an error. (A common pitfall for new users, IMHO). Also: ;; is a special delimiter, for case statements. Commented Oct 6, 2014 at 18:10
  • 1
    @muru: Good point, but let's generalize it. Any of the control operators that can appear between commands: ;, &&, ||, &, and |, are errors if they appear with nothing preceding them. Also, terdon addressed ;; (briefly) in his answer. Commented Oct 6, 2014 at 18:31
  • 1
    @Wildcard: OK, I see where you're coming from.  The key word is "may"; all I was saying was that I don't guarantee that all shells will accept such constructs (i.e., YMMV).  Obviously I wrote that before I knew about the use of the linebreak token in the POSIX shell grammar.  So perhaps it's safe to say that all POSIX-compliant shells will accept them.  I stand by my statement as a general disclaimer; if you find an old enough pre-POSIX shell, such as an actual Bourne shell or older, all bets are off. Commented Mar 30, 2016 at 5:35