LINENO is set to zero during the execution of aliases or commands in
'eval'. This behaviour is different from that of other shells.
#! /usr/bin/env mksh
alias showlineno='echo $LINENO'
eval 'echo $LINENO'
showlineno
Actual output:
0
0
Expected output:
3 (or 1)
4
This behaviour seems to be
Martijn Dekker dixit:
>LINENO is set to zero during the execution of aliases or commands in
>'eval'. This behaviour is different from that of other shells.
Patches welcome ☺
(What do you *use* LINENO for? I’ve *never* seen it used *at all*.)
>Output on various shells:
>mksh: 1 2 0
On 3/19/17 5:51 PM, Stephane Chazelas wrote:
> On comp.unix.shell ot http://unix.stackexchange.com, I've posted
> many articles describing how to do splitting in POSIX-like
> shells:
>
> ( # subshell for local scope
> unset -v IFS # restore default splitting behaviour
> set -o noglob #