> I met a problem about Linux command 'rm', I created a file named as =
> "--full-time" by occasionally, then i tried to remove it, I had already =
> tried following cmd under bash:
> 
> 1)  rm  --full-time
> 2)  rm  "--full-time"
> 3)  rm  \-\-full\-time
> 
> As a result the three approaches all failed.
> 
> So I think there might be some BUGs in cmd 'rm' or 'bash'?

There is no bug there.  The rm command is interpreting the first
argument as an option instead of as a filename.  It looks like an
option and so that makes sense.  Quoting it won't change things.
Prove that to yourself using the echo command to print what the rm
command would see.  Quoting would only protect against shell
metacharacter ($, *, |, ;, etc.) expansion.

  echo rm  --full-time
  rm --full-time
  echo rm  "--full-time"
  rm --full-time
  echo rm  \-\-full\-time
  rm --full-time

You need to make the file not look like an option.  Either specify the
path or explicitly mark the end of options with "--".

  rm ./--full-time
  rm /full/path/to/--full-time
  rm -- --full-time

Bob

_______________________________________________
Bug-fileutils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-fileutils

Reply via email to