16

We know that the backtick character is used for command substitution:

chown `id -u` /mydir

Which made me wonder: is the tick character ´ used for anything in the Linux shell?


Note: incidentally, command substitution can also be written more readably as
chown $(id -u) /mydir

dr_
  • 29,602
  • 3
    I was unsure of the name, but I thought ´ is called acute accent only when used as a diacritic (and, conversely, ``` is called grave accent). When used alone, as the latter is a backtick, it seemed natural for the former to be called a tick or forward tick (please let's not call it reverse backtick). I've modified the title question to include your note. – dr_ Nov 02 '18 at 10:20
  • 1
    fair enough. I've removed the comment. – Stéphane Chazelas Nov 02 '18 at 10:26
  • 1
    @dr01 It might be worth putting in the title something like "(not `)" to help with confusion. – Captain Man Nov 02 '18 at 14:02
  • A similar-looking character, the apostrophe (', ASCII 39, U+0027) has meaning in many of the Unix shells (e.g. the Bourne shell /bin/sh) and Linux shells (e.g. /bin/bash). It prevents words splitting and all expansions. So ls '$foo [bar]' returns an error unless there is a file named $foo [bar] in the current directory. It's equvalent to ls "\$foo [bar]" and ls \$foo\ \[bar\]. – pts Nov 02 '18 at 14:24
  • 1
    There are many similar-looking characters in Unicode, see https://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html for an incomplete list, and see https://en.wikipedia.org/wiki/Prime_(symbol) for some more symbols. Out of all these, only the ASCII characters (', ", ```) have special meaning in Unix shells. – pts Nov 02 '18 at 14:33

2 Answers2

30

The character sets used historically with Unix, including ASCII, don’t have a tick character, so it wasn’t used. As far as I’m aware no common usage for that character has been introduced since it’s become available; nor would it, since it’s not included in POSIX’s portable character set.

` was apparently originally included in ASCII (along with ^ and ~) to serve as a diacritic. When ASCII was defined, the apostrophe was typically represented by a ′-style glyph (“prime”, as used for minutes or feet) rather than a straight apostrophe ', and was used as a diacritic acute accent too.

Historically, in Unix shell documentation, ` was referred to as a grave accent, not a backtick. The lack of a forward tick wouldn’t have raised eyebrows, especially since ' was used as the complementary character (see roff syntax).

Stephen Kitt
  • 434,908
  • 6
    "Presumably ´ wasn’t considered common enough to make the cut (despite its widespread use in non-American languages)." Touché. – dr_ Nov 02 '18 at 10:03
  • 6
    Characters outside the POSIX portable character set (a subset of ASCII) would not be used in the syntax of shells, as their encoding would typically vary between locales (and may not be found in some including the C locale). For instance, on a GNU system, ´ is 0xB4 in a fr_FR.iso88591 locale, 0xC2 0xB4 in a fr_FR.UTF-8 and doesn't exist in the C locale. – Stéphane Chazelas Nov 02 '18 at 10:10
  • @StéphaneChazelas What you say remains true even if fr_FR is replaced with any other language. The encoding of the character is a property of the encoding (ISO-8859-1 or UTF-8). – kasperd Nov 02 '18 at 17:00
  • 2
    @kasperd, yes, I did not mean to imply that the language made a difference. The choice of fr_FR was arbitrary, it just happens I have such locales on my system. Of course it would be the same with en_GB.UTF-8... – Stéphane Chazelas Nov 02 '18 at 17:05
13

Although the ASCII committee thought of ` as a diacritic and ' as an apostrophe, the Unix tradition was to treat them as left and right single quotes (the characters that are now in Unicode as U+2018 and U+2019). This is most obvious from the TeX convention that you write ``quoted text'' in the markup source and you get “quoted text” in the formatted document. This can also be seen in older monospace fonts, such as the bitmap fonts shipped with X11R5 and X11R6, where the two characters were given mirror-image glyphs.

As such, ` and ' were considered each others' inverse, and ´ was not felt to be missing.

zwol
  • 7,177
  • 3
    Ah yes, I remember that LaTeX syntax! – dr_ Nov 02 '18 at 14:47
  • 1
    @dr01: Which suddenly makes sense when you discover some of the old fonts have them as mirrors of each other. – Joshua Nov 02 '18 at 16:06
  • @Joshua Thanks for reminding me about that, I have added mention of it to the answer. Do you happen to know where specimens of those fonts could be found? I'm not having any luck on a casual web search. – zwol Nov 02 '18 at 16:15
  • @zwol: I'm pretty sure they were VGA console fonts though there's a remote possibility they were xterm raster fonts. – Joshua Nov 02 '18 at 16:24
  • 3
    ' was explicitly defined in ASCII as APOSTROPHE, RIGHT SINGLE QUOTATION MARK, ACUTE_ACCENT by ANSI, it's not only a Unix thing. There is no other right single quotation mark in ASCII. – Stéphane Chazelas Nov 02 '18 at 16:35
  • 2
    @Joshua: The changing of said fonts was a matter of major controversy/backlash when it happened (probably late 90s or shortly after 2000). It was not just xterm fonts, but all of the standard X11 bitmap fonts, including the bitmap Times/Helvetica/etc. used in browsers and other applications with proportional-spaced fonts. – R.. GitHub STOP HELPING ICE Nov 02 '18 at 17:09
  • 1
    Not enough backlash to stop it unfortunately! Unicode advocates running around telling everybody the ASCII apostrophe is a vertical line, in direct contradiction to the example glyph in the actual ASCII standard... and now almost every font has that stupid thing in position 0x27 instead of a decent-looking apostrophe –  Nov 02 '18 at 19:38
  • @WumpusQ.Wumbley: Don't blame Unicode for Microsoft's stupidity, they were just picking up the pieces after the abomination that was "smart" quotes. – Kevin Nov 03 '18 at 05:07