bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Odd LINENO behaviour in 'eval'


From: Martijn Dekker
Subject: Odd LINENO behaviour in 'eval'
Date: Mon, 20 Mar 2017 03:58:38 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.7.1

Test script:
printf "$LINENO "
printf "$LINENO "
eval '  printf "$LINENO "
        printf "$LINENO "
        printf "$LINENO " '
printf "$LINENO\n"

Output on various shells:
            bash: 1 2 5 6 7 6  (?!)
     {m,l,pd}ksh: 1 2 0 0 0 6  (?)
      AT&T ksh88: 1 2 3 3 3 6
      AT&T ksh93: 1 2 1 2 3 6
      FreeBSD sh: 1 2 1 2 3 6
            dash: 1 2 1 2 3 6
            yash: 1 2 1 2 3 6
    zsh (native): 1 2 1 2 3 6
        zsh (sh): 1 2 3 3 3 6  (like ksh88)

It is unclear to me why bash starts counting the 'eval' lines at 5. Is
this a bug?

- M.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]