I tested:
rm \-\-remove-files
but I am unable to remove it. How can I do it?
I tested:
rm \-\-remove-files
but I am unable to remove it. How can I do it?
$ ls -lah -- --remove-files
-rw-r--r-- 1 xistence xistence 0B May 4 19:29 --remove-files
$ rm -- --remove-files
$ ls -lah -- --remove-files
ls: --remove-files: No such file or directory
So what you want is to use the -- as one of the arguments to rm, that means it stops processing getopt's, after that anything is taken literally:
rm -- --remove-files
rm ./--remove-files
.
Note that --
isn't interpreted by the shell, and by extension, escaping it with \
will have no effect.
The solution is:
rm -- --remove-files
Source: http://www.cyberciti.biz/faq/unix-linux-remove-strange-names-files/