rm -- --somefile
While this works, this is an rm based solution using getopts to parse its options. There are applications that conduct their own analysis and will also fail (because they may not necessarily implement the logic β -- means the end of optionsβ).
Because of this, the solution you must pass through your skull is:
rm ./--somefile
It will always work, because in this way your arguments never begin with - .
Also, if you are trying to make really worthy shell scripts; you must technically put ./ in front of all your file name parameter extensions so that your scripts do not interrupt due to a funky file name input (or to prevent abuse / use to perform actions that they should not do: for example, rm will delete files, but skips directories, and rm -rf * deletes everything. Passing the file name " -rf " to the script or someone touch ~victim/-rf 'can thus be used to change its behavior with very bad consequences).
lhunath Apr 01 '09 at 19:10 2009-04-01 19:10
source share