I have directory name starting with --. How to enter it with cd? Basic escape charaters is not working
# 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)
You can use cd like this:
cd -- '--smol--'
OR:
cd -- --smol--
Anything after -- are not considered options for cd command.
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