Module Name:    src
Committed By:   kre
Date:           Fri Feb 24 19:04:54 UTC 2023

Modified Files:
        src/bin/sh: alias.c

Log Message:
Allow (but do not require) the magic '--' option terminator in
the builtin 'alias' command.   This allows portability (not that
anyone should really care with aliases) for scripts from other
shells in which the alias command has options, and the -- is
required to allow the first alias name to begin with a '-'.

That is, for us, alias -x='echo x'  works fine, always has,
and still does.   But other shells treat that as an attempt
to use the -x option (and maybe -= etc), and require
alias -- -x='echo x'.   For us that variant used to complain
about the alias -- not existing (as an arg with no '=' is
treated as a request to extract the value of the alias).

Posix also generally requires all standard commands (or
which "alias" is one, unfortunately) to support '--' even
if they have no options, for precisely this reason.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/bin/sh/alias.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Reply via email to