Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: newbie rm --^file question



# akhst7@xxxxxx / 2016-12-25 18:02:16 -0500:
> Got it.  Putting a space between “--“ and “-“  did it.   I really
> appreciate your explanation of the different usage of  the “--”
> argument for rm. I though it was specific to zsh like “^”. 

"--" is a POSIX thing.

XCU 12.2 Utility Syntax Guidelines:

Guideline 10:
    The first -- argument that is not an option-argument should be
    accepted as a delimiter indicating the end of options. Any following
    arguments should be treated as operands, even if they begin with the
    '-' character.

(http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html)

XCU 1.4 Utility Description Defaults:

OPTIONS:

  [...]

  Default Behavior: When this section is listed as "None.", it means that
  the implementation need not support any options. Standard utilities that
  do not accept options, but that do accept operands, shall recognize "--"
  as a first argument to be discarded.

  The requirement for recognizing "--" is because conforming applications
  need a way to shield their operands from any arbitrary options that the
  implementation may provide as an extension. For example, if the standard
  utility foo is listed as taking no options, and the application needed
  to give it a pathname with a leading <hyphen-minus>, it could safely do
  it as:

  foo -- -myfile

  and avoid any problems with -m used as an extension.

(http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap01.html#tag_17_04)

-- 
roman



Messages sorted by: Reverse Date, Date, Thread, Author