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

Can $_ substitute $0 when nofunctionargzero



Hello,
this (one line):
mkdir -p pathcomponent; echo 'echo "0: $0, _: $_";' >
pathcomponent/sourceme; setopt nofunctionargzero; source
pathcomponent/sourceme

outputs:
0: /bin/zsh, _: pathcomponent/sourceme

So it looks like $_ can take back what nofunctionargzero takes away:
path to sourced file. Normally $0 is used in many plugins, making them
incompatible with nofunctionargzero. Z-sy-h has an explicit check for
this and does:

  echo "zsh-syntax-highlighting: error: not compatible with
NO_FUNCTION_ARGZERO" >&2

Can $_ take over? This would mean such scripts can be compatible with
emulate sh and ksh.

Best regards,
Sebastian Gniazdowski



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