Create Directory with Hypen
-- to create a directory with a hyphen in the name. This disables further option parsing.
mkdir -- -my-dir
Put additional options always before
mkdir -p -- -my-dir/foo
This is a convention that is part of the POSIX standard. The argument
-- is a delimiter indicating the end of options. Any following arguments should be treated as operands, even if they begin with the '-' character.
Alternatively, use the current directory prefix
This also applies to other commands such as
cd -- -my-dir
rm -r -- -my-dir
My Tech Newsletter
Get emails from me about programming & web development. I usually send it once a month