Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Escape character
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Bourne shell=== In [[Bourne shell]] (sh), the [[asterisk]] ({{code|*}}) and [[question mark]] ({{code|?}}) characters are [[wildcard character]]s expanded via [[globbing]]. Without a preceding escape character, an {{code|*}} will expand to the names of all files in the [[working directory]] that do not start with a period [[if and only if]] there are such files, otherwise {{code|*}} remains unexpanded. So to refer to a file literally called "*", the shell must be told not to interpret it in this way, by preceding it with a backslash ({{code|\}}). This modifies the interpretation of the asterisk ({{code|*}}). Compare: {| |- | style="width:25px;"| <!--indented-->|| <syntaxhighlight lang="bash"> rm * # delete all files in the current directory </syntaxhighlight> <syntaxhighlight lang="bash"> rm \* # delete the file named * </syntaxhighlight> |} Similarly, characters like the [[ampersand]], [[Vertical bar|pipe]] and [[semicolon]] (used for command chaining), angle brackets (used for [[Redirection (computing)|redirection]]), and parentheses have special syntactic meaning to the Bourne shell. These must also be escaped—referred to as "quoting" in the {{code|sh(1)}} manual page<ref>https://heirloom.sourceforge.net/sh/sh.1.html#8</ref>—in order to be used literally as arguments to another program: <syntaxhighlight lang="console"> $ echo (`-´)> # not escaped or quoted bash: syntax error near unexpected token ``-´' $ echo \(`-´\)\> # escaped with backslashes (`-´)> $ echo '(`-´)>' # protected by single quotes; same effect as above (`-´)> $ echo ;) # syntax error $ echo ';)' \;\) # both OK </syntaxhighlight>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)