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

Re: [BUG]builtin echo error doing arguments parsing



On Wed, 21 Feb 2018 23:23:09 -0800
wumingxwk@xxxxxxxxx wrote:
> if there is only a '-' as argument,builtin echo won't print it

It's entirely deliberate and documented, but you're quite right that it
plays merry hell with compatibility.

You might have thought it should at least be turned off in some or most
of the emulation modes...

pws


SHELL BUILTIN COMMANDS

...

All  builtin  commands other than precommand modifiers, even those that
have no options, can be given the argument  `--'  to  terminate  option
processing.   This  indicates  that  the following words are non-option
arguments, but is otherwise ignored.  This is  useful  in  cases  where
arguments  to  the command may begin with `-'.  For historical reasons,
most builtin commands also recognize a single `-' in  a  separate  word
for  this  purpose;  note that this is less standard and use of `--' is
recommended.



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