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*

7
  • 1
    You're describing the behaviour of the the fish shell, not Bourne-like shells where the single quote quotes every character (backslash is not special within '...'). Note that in fish, % is also a special character. Commented Jul 15, 2016 at 17:08
  • @StéphaneChazelas I don't know how fish works, but my experience is that, in sh, echo '\\' echoes \ and echo '\'' echoes '. Commented Jul 15, 2016 at 17:55
  • 1
    echo '\\' outputs \ because your echo expands ANSI C escape sequences (some echo implementations need echo -e '\\' for that). printf '%s\n' '\\' outputs \\. Commented Jul 15, 2016 at 18:01
  • Note that sh does not identify a particular shell, there are and have been a lot of different and often incompatible shells called sh. Commented Jul 15, 2016 at 18:03
  • @StéphaneChazelas Oh okay, I will change that now. By the way, is \' a special token inside a single-quoted character sequence? Commented Jul 15, 2016 at 18:04