Hello Adrian

> when trying to work with file names beginning with a dash (a '-') the file
> utils (rm , ls , ...) interpret those names as options, resulting a
> "denial of service". It is not possible to work with these files in
> command line (as far as I know).

As you noted since the file name begins with a '-' it looks like an
option to the command.  You need to force it to not look like an
option.  Put a ./ in the front of it.  Or give it the full file name
path.  Or tell the command you are through with options.

  rm ./-stuff
  rm /full/path/-stuff
  rm -- -stuff

The man page for the rm command documents this behavior.  Here is a
snippet from the rm man page.

      GNU rm, like every program that uses the getopt function to
      parse its arguments, lets you use the -- option to indicate that
      all following arguments are non-options.  To remove a file
      called `-f' in the current directory, you could type either
           rm -- -f
      or
           rm ./-f

This is generally a common behavior for most UNIX programs that
contain options.  The -- is a common behavior for most programs but
unfortunately there are different standards that different programs
follow.  But one of the two should always be sufficient for robust
operation.

Hope this helps

Bob Proulx

Reply via email to