mac osx: how to cd to the folder with a name which the first character is "-"?

StackOverflow https://stackoverflow.com/questions/19708840

  •  02-07-2022
  •  | 
  •  

Pregunta

There is a foler which name is "-Tmp-", how can I cd into it?

When I use cd, it prompt as:

$ cd -Tmp-/
cd: -T: invalid options

Anybody can help me?

¿Fue útil?

Solución

Use -- to stop argument parsing.

$ cd -- -Tmp-
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top