5/29/2023 0 Comments Quotes folderA single quote may not occur between single quotes, even when preceded by a backslash. Quoting with single quotes ' 'Įnclosing characters in single quotes preserves the literal value of each character within the quotes. So to enter a directory or a file with a special character, escape at least the latter or a greater part of your filename or path with double quotes, e.g.: cd space" "dir # change into directory called “space dir”Ĭat "space file" # print the content of file “space file”Īs $, ` and ! keep their special meaning inside double quotes, Parameter Expansion, Command Substitution, Arithmetic Expansion and History Expansion are performed on double-quoted strings. Quoting with double quotes " "Įnclosing characters in double quotes preserves the literal value of all characters within the quotes, with the exception of $, `, \, and, when history expansion is enabled, !. So to enter a directory or a file with a special character, escape the latter with \, e.g.: cd space\ dir # change into directory called “space dir”Ĭat space\ file # print the content of file “space file”Įcho content > \\ # print “content” into file “\”īash's Programmable Completion (aka Tab ↹ Completion) automatically escapes special characters with the escape character \. It preserves the literal value of the next character that follows, with the exception of. Quoting with the escape character \Ī non-quoted backslash ( \) is the escape character. (…) There are three quoting mechanisms: the escape character, single quotes, and double quotes. Quoting is used to remove the special meaning of certain characters or words to the shell. What you're asking for is called Quoting: Tab ↹ Completion takes care of proper quoting. Tl dr: To quote a special character either escape it with a backslash \ or enclose it in double " " or single quotes ' '.
0 Comments
Leave a Reply. |