我的目录名以 - 开头.如何用cd输入?基本的逃脱字符不起作用
# cd --smol--/
-bash: cd: --: invalid option
cd: usage: cd [-L|[-P [-e]]] [dir]
# cd \-\-smol\-\-
-bash: cd: --: invalid option
cd: usage: cd [-L|[-P [-e]]] [dir]
# cd '--smol--'
-bash: cd: --: invalid option
cd: usage: cd [-L|[-P [-e]]] [dir]
# cd '\-\-smol\-\-'
-bash: cd: \-\-smol\-\-: No such file or directory
# help
GNU bash, version 4.2.37(1)-release (i486-pc-linux-gnu)
Run Code Online (Sandbox Code Playgroud)
你可以cd像这样使用:
cd -- '--smol--'
Run Code Online (Sandbox Code Playgroud)
要么:
cd -- --smol--
Run Code Online (Sandbox Code Playgroud)
之后--的任何事情都不被视为cd命令选项.