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

Re: LINENO behaviour in sh mode



On Mar 20,  3:57am, Martijn Dekker wrote:
}
} Output on various shells:
}             bash: 1 2 5 6 7 6  (?!)

Clearly bash is incrementing LINENO through the parse of the eval and
then continuing to increment it through the execution.

I'm mildly surprised that no shell prints "1 2 3 4 5 6".

}         zsh (sh): 1 2 3 3 3 6  (like ksh88)
} 
} Since ksh88 is dead and buried (even Solaris now has ksh93 as their
} /bin/sh), it looks like zsh's "sh" mode is not emulating any current sh.
} Maybe 'emulate sh' should no longer turn off the EVAL_LINENO option.

You're forgetting about the second effect of this, which is to print
"(eval)" in xtrace output instead of the script or function name.  Try
your test again with "set -x" ... Do we need a separate option?

Also, how should the doc be updated, given that csh emulation would
become the outlier?



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