Using/reading/writing the null and escape characters
11
votes
4
answers
46206
views
I know that a filename in Linux has no restriction whatsoever except for two characters
'/'
and '\0'
. I know that '/'
is prohibited because it is a directory separator but **is there any other reason** ?
Also on my terminal I can create a file or a directory with the name \0
. So I wonder **how to write the null character correctly** because obviously it shouldn't allow me to have a filename with null in it
mkdir '\0'
will create a directory named \0
One more question, If I want to include $
in my filename, I can use the backslash
mkdir \$myfile
will create a directory named $myfile
However, I can do the same if I surround the dollar sign with single quotes and double quotes
mkdir \$myfile
is the same as mkdir '$'myfile
is the same as mkdir "$"myfile
is the same as mkdir '$myfile'
is the same as mkdir "$myfile"
So my question is, **Are the single and double quotes a substitution for the escape backslash character?**
**Also what other characters need escaping in bash besides $
, (space) and backslash ?**
Asked by alkabary
(1539 rep)
Aug 17, 2015, 11:12 PM
Last activity: Apr 29, 2022, 04:51 AM
Last activity: Apr 29, 2022, 04:51 AM