How can I create a file named "-file" using command line in Linux?
Asked
Active
Viewed 1.2k times
3 Answers
19
specify a path in front of it, e.g. ./-file

Stefan Hegny
- 2,107
- 4
- 23
- 26
-
that is what I need! – sebthesaviour Nov 17 '16 at 09:08
17
In bash --
is a flag that is interpreted as "nothing after this should be taken as a flag", so -
is no longer parsed as an option.
touch -- -file

karel
- 5,489
- 46
- 45
- 50
0
ls -ltr | awk '$NF ~ /^--/{print "rm ./" $NF}'|sh

user8854776
- 173
- 1
- 7
-
While this code may answer the question, providing additional context regarding how and/or why it solves the problem would improve the answer's long-term value. You can find more information on how to write good answers in the help center: https://stackoverflow.com/help/how-to-answer . Good luck – nima Oct 19 '21 at 12:38
-