Reputation: 61
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)
Upvotes: 4
Views: 2301
Reputation: 786021
You can use cd
like this:
cd -- '--smol--'
OR:
cd -- --smol--
Anything after --
are not considered options for cd
command.
Upvotes: 6