A backslash at the end of a line in a shell script makes the shell ignore the newline for the purposes of executing the script. This is normally used to split long lines in a script file into multiple text lines, which will be handeled as a single script line by the shell.
The Linux kernel default lets Ctrl-Backspace generate BackSpace - this is sometimes useful as emergency escape, when you find you can only generate DELs. The left Alt key is sometimes called the Meta key, and by default the combinations AltL-X are bound to the symbol MetaX.
A non-quoted backslash ' \ ' is the Bash escape character. It preserves the literal value of the next character that follows, with the exception of newline .
In Unix systems, and even some programming languages like C, the role of the backslash is to indicate to the system that the next character has a special meaning. Therefore, it works as an escape character. For example, a lowercase n, when used with a backslash, \n, indicates a new line character.
alias curl='curl --some --default --options'
If you have an alias for curl
and you don't want to use it, putting a backslash in front disables the alias and runs the curl binary directly.
Note that this only applies at an interactive shell. Aliases don't take effect in scripts so it would be unnecessary there.
The (Bourne/POSIX) shell specification says that alias substitution in an interactive shell is suppressed when any character of the command word is quoted. A backslash is one way to do that, but there are also other well known ways to quote: single and double quotes. All of the following will suppress alias substitution:
\curl
cur\l
\c\u\r\l
"c"url
"curl"
"c""u""r""l"
'curl'
'cu'"rl"
Using \curl
is just the most common and readable way. Since this is a standardized feature, you can expect it to work in all Bourne-heritage shells.
\curl
looks a bit like a TeX command, doesn't it? :-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With