문제

Trying to mkdir with a leading hyphen in the name.

 mkdir -foo-
 mkdir '-foo-'
 mkdir `-foo-`
 mkdir `echo '-foo-'`

None of these work. Is there any way to do this?

도움이 되었습니까?

해결책

Try using -- to disable further option parsing:

mkdir -- -foo

다른 팁

How about

$ mkdir ./-dir

in order to specify the directory with the current dir prefixed. The same 'trick' can be used with all other command line utils (e.g. rmdir, rm etc.).

I perhaps wouldn't create such a directory, though, unless it's really necessary. It's a little counter-intuitive and may cause similar confusion for others in the future.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top