Solution for Terminal, double quotation marks create single quotation output
is Given Below:
I’m on my Mac Terminal and I don’t know why but when I make directory, it’s creating a single quotation mark.
It works perfectly fine when there is no space between words
> mkdir "some folder"
> ls
'some folder'
> mkdir "amazon"
> ls
'some folder'
amazon
What is causing this? and how do i fix it so that i make a directory called some folder
not 'some folder'
Also I have a python file that creates a csv using the arguments given. But it’s also creating stuff like this:
> python somefile.py "vitamin c" "hi" "dog cat"
'"vitamin .csv'
'c".csv'
'hi.csv'
'"dog.csv'
'cat".csv'
should be:
> python somefile.py "vitamin c" "hi" "dog cat"
vitamin c.csv
hi.csv
dog cat.csv
The folder really is named some folder
, with no quote marks. But the ls
program is trying to be helpful, to make it obvious that it isn’t two directory entries some
and folder
, and to make it easier to copy and paste the name into a valid shell command.
One way to stop ls
from adding the quotes is
ls --literal -1
The --literal
means not to add any quote marks, backslashes, etc. The -1
means to make sure there’s one directory entry on each line.