\curl -L https://get.rvm.io | bash -s stable
Run Code Online (Sandbox Code Playgroud)
为什么命令以\?开头?
这是我看到它的网站.
Joh*_*ica 190
alias curl='curl --some --default --options'
Run Code Online (Sandbox Code Playgroud)
如果您有别名curl并且不想使用它,则在前面添加反斜杠会禁用别名并直接运行curl二进制文件.
请注意,这仅适用于交互式shell.别名在脚本中不起作用,因此在那里没有必要.
Jen*_*ens 153
(Bourne/POSIX)shell规范指出,当引用命令字的任何字符时,将禁止交互式shell 中的别名替换.反斜杠是一种方法,但也有其他众所周知的引用方式:单引号和双引号.以下所有内容都将禁止别名替换:
\curl
cur\l
\c\u\r\l
"c"url
"curl"
"c""u""r""l"
'curl'
'cu'"rl"
Run Code Online (Sandbox Code Playgroud)
使用\curl只是最常见和可读的方式.由于这是一个标准化的功能,您可以期望它适用于所有Bourne-heritage shell.
\curl看起来有点像TeX命令,不是吗?:-)