4

GNU tools often output error and warning messages with parts of the line (e.g. filenames, syntax errors, invalid dates, etc) quoted with non-matching quotes: ` and '

e.g. From the GNU coreutils FAQ:

$ date -d "2006-04-02 02:30:00" date: invalid date `2006-04-02 02:30:00' 

and

rm: cannot remove `backup.tar': Value too large for defined data 

Why do they do this? Is there any benefit to it? What's the history behind it?

13
  • 1
    These are just old-school ‘smart quotes’, right? Commented Nov 7, 2015 at 5:48
  • i assume that's what they are meant to be. i'm wondering what made them think it was a good idea. Commented Nov 7, 2015 at 5:49
  • 2
    I think just because it's the correct way to write them, especially in light of the early days of electronic character encoding. (But that's pure speculation.) Commented Nov 7, 2015 at 5:51
  • 1
    seems to be version dependent. my date (date (GNU coreutils) 8.23) outputs date: invalid date ‘2006-02-31 02:30:00’ which is date: invalid date \342\200\2302006-02-31 02:30:00\342\200\231$, unicode left and right single quotation marks. the faq entry above uses a backtick and an apostrophe. Commented Nov 7, 2015 at 6:03
  • 1
    It's been asked before. Commented Nov 7, 2015 at 8:16

1 Answer 1

5

With old X fonts, `..' looked symmetrical like ‛..’

Also given `..' latex generates correct left and right single quotes like ‘..’

So `..' was a hack and in 2012 coreutils changed to shell like quoting '..'

Now it wasn't full shell syntax however and would generate corrupted output if there were embedded "\r" chars etc. present. Also inconsistently in some cases no quoting was used, and sometimes unicode ‘..’ quoting was used (which uses quotes as defined for the locale and caters for escaping these control characters).

A very recent (2015) patch set was introduced to coreutils to make this more consistent, by quoting all file name output in shell compat format, which also escapes control characters appropriately, and allows for easier copy and pasting back to other commands. Other items in diagnostics use "full unicode" quoting as mentioned above.

2
  • cool, so no need for me to submit a new bug report. I just have to wait for the update to make its way to debian sid. in the meantime, do you know if there's a shell variable I can set (other than, e.g., LANG=C) to control the quoting style? Commented Nov 8, 2015 at 2:10
  • only for ls which honors QUOTING_STYLE=shell etc. Commented Nov 8, 2015 at 18:54

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.