This question already has an answer here:
- How to remove files starting with double hyphen? 7 answers
- rm cannot delete files starting with — [duplicate] 3 answers
After a mistake in a script I ended up with a file whose name starts with a dash '-'
-myfile.txt
I tried so far :
rm -myfile.txt
rm: illegal option -- m
usage: rm [-f | -i] [-dPRrvW] file ...
unlink file
rm "-myfile.txt"
rm: illegal option -- m
usage: rm [-f | -i] [-dPRrvW] file ...
unlink file
rm "\-myfile.txt"
rm: \-myfile.txt: No such file or directory
rm \-myfile.txt
rm: illegal option -- m
usage: rm [-f | -i] [-dPRrvW] file ...
unlink file
rm "-"myfile.txt
rm: illegal option -- m
usage: rm [-f | -i] [-dPRrvW] file ...
unlink file
Do you have any idea ?
Thanks