Re: wrong lineno inside trap?
Chet Ramey wrote: Bash-4.0 should behave better in this area, but quoted strings will always cause unpredictable values for $LINENO. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Chet Ramey, ITS, CWRUc...@case.edu http://cnswww.cns.cwru.edu/~chet/ Thanks for the explanation. -- View this message in context: http://www.nabble.com/wrong-lineno-inside-trap--tp21383479p21472277.html Sent from the Gnu - Bash mailing list archive at Nabble.com.
Re: wrong lineno inside trap?
peter360 wrote: I wrote a test program test.sh: trap ' echo this is line 3, but LINENO=$LINENO ' 0 echo this is line 7, and LINENO=$LINENO --- when I ran it I got $ sh /tmp/test.sh this is line 7, and LINENO=7 this is line 3, but LINENO=11 My bash version is $ sh --version GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu) Copyright (C) 2005 Free Software Foundation, Inc. Is this a known problem? Thanks. Bash-4.0 should behave better in this area, but quoted strings will always cause unpredictable values for $LINENO. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
wrong lineno inside trap?
I wrote a test program test.sh: trap ' echo this is line 3, but LINENO=$LINENO ' 0 echo this is line 7, and LINENO=$LINENO --- when I ran it I got $ sh /tmp/test.sh this is line 7, and LINENO=7 this is line 3, but LINENO=11 My bash version is $ sh --version GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu) Copyright (C) 2005 Free Software Foundation, Inc. Is this a known problem? Thanks. -- View this message in context: http://www.nabble.com/wrong-lineno-inside-trap--tp21383479p21383479.html Sent from the Gnu - Bash mailing list archive at Nabble.com.
Re: wrong lineno inside trap?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to peter360 on 1/9/2009 6:07 PM: trap ' echo this is line 3, but LINENO=$LINENO ' 0 echo this is line 7, and LINENO=$LINENO Is this a known problem? Thanks. In general, LINENO handling is inconsistent among shells. The presence of single vs. multi-line constructs, eval, here-docs, and shell functions cause different shells to give different values to LINENO. For more documentation on this, see: http://www.gnu.org/software/autoconf/manual/html_node/Special-Shell-Variables.html#Special-Shell-Variables and this update to the documentation source, detailing even more inconsistencies: http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=10d26aa - -- Don't work too hard, make some time for fun as well! Eric Blake e...@byu.net -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkln/YgACgkQ84KuGfSFAYAiHQCfXdr95aIJvrb7NzunhvYDgEiU fyQAnj2yJ/gkRLRrvWJeqAOR1CnDKflj =NtxW -END PGP SIGNATURE-