2

I create a directory called bob@example.com/

I wanted to use this email address as the directory name - I know - not a good idea for many reasons - but lets assume this is a very temporary directory that I delete seconds later :)

I give the command

mkdir bob@example.com

However when I check the directory I see it actually created it with quotes around it.

...
'bob@example.com`
...

I then found this is due to the @

What are the rules for special characters in directory names and how does the system decide to quote them

  • 1
    I'm on Mint and can't replicate? – schrodigerscatcuriosity Nov 13 '19 at 15:14
  • Could you copy and paste the output from ls into your question? Or does it really end with a backtick? – Stephen Kitt Nov 13 '19 at 15:31
  • Is your ls aliased to ls --quoting-style=locale? That's the only way I can replicate it. (although I get surrounding unicode quotes, not single quotes or backticks) – Jeff Schaller Nov 13 '19 at 15:42
  • @jeff, yes it is and i think that is indeed part of the issue. ty – Michael Durrant Nov 13 '19 at 16:02
  • 'cos /usr/bin/ls doesn't have the issue. My ls is an alias to alias ls='ls -F --color=al' – Michael Durrant Nov 13 '19 at 16:03
5

This is just the way that ls displays the name, and does not mean that the name contains literal quotes.

If your ls is aliased to use --quoting-style=locale, that would produce:

‘bob@example.com’

... with unicode "LEFT SINGLE QUOTATION MARK" and "RIGHT SINGLE QUOTATION MARK" characters surrounding the filename(s).

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.