/[autoconf]/autoconf/doc/autoconf.texi
ViewVC logotype

Diff of /autoconf/doc/autoconf.texi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.554 by Zastai, Tue Oct 23 17:18:44 2001 UTC revision 1.555 by eggert, Fri Oct 26 19:52:07 2001 UTC
# Line 8187  builtin @command{unset}, for more detail Line 8187  builtin @command{unset}, for more detail
8187  @item LINENO  @item LINENO
8188  @evindex LINENO  @evindex LINENO
8189  Most modern shells provide the current line number in @code{LINENO}.  Most modern shells provide the current line number in @code{LINENO}.
8190  Its value is the line number of the beginning of the current command  Its value is the line number of the beginning of the current command.
8191  (see below the output of the here document).  The behavior wrt  Autoconf attempts to execute @command{configure} with a modern shell.
8192  @command{eval} differs according to the shell, but, amusingly, not in  If no such shell is available, it attempts to implement @code{LINENO}
8193  the case of sub shells:  with a simple Awk+Sed prepass that replaces the first instance of the
8194    string @code{$LINENO} in each line with the line's number.
8195    
8196    You should not rely on @code{LINENO} within @command{eval}, as the
8197    behavior differs in practice.  Also, the possibility of the Awk+Sed
8198    prepass means that you should not rely on @code{$LINENO} when quoted,
8199    when in here-documents, or when in long commands that cross line
8200    boundaries or that have multiple instances of $LINENO.  Subshells
8201    should be OK, though.  In the following example, lines 1, 6, and 10
8202    are portable, but the other instances of @code{LINENO} are not:
8203    
8204  @example  @example
8205  @group  @group
# Line 8202  cat <<EOF Line 8211  cat <<EOF
8211  EOF  EOF
8212  ( echo 6. $LINENO )  ( echo 6. $LINENO )
8213  eval 'echo 7. $LINENO'  eval 'echo 7. $LINENO'
8214    echo 8. $LINENO $LINENO
8215    echo 9. '$LINENO'
8216    echo 10. $LINENO '
8217    11.' $LINENO
8218  @end group  @end group
8219  @group  @group
8220  $ @kbd{ash lineno}  $ @kbd{bash-2.05 lineno}
 1.  
 3.  
 4.  
 6.  
 7.  
 @end group  
 @group  
 $ @kbd{bash-2.03 lineno}  
8221  1. 1  1. 1
8222  3. 2  3. 2
8223  4. 2  4. 2
8224  6. 6  6. 6
8225  7. 1  7. 1
8226    8. 8 8
8227    9. $LINENO
8228    10. 10
8229    11. 10
8230  @end group  @end group
8231  @group  @group
8232  $ @kbd{zsh-3.1.9 lineno}  $ @kbd{zsh-3.0.6 lineno}
8233  1. 1  1. 1
8234  3. 2  3. 2
8235  4. 2  4. 2
8236  6. 6  6. 6
8237  7. 7  7. 7
8238    8. 8 8
8239    9. $LINENO
8240    10. 10
8241    11. 10
8242  @end group  @end group
8243  @group  @group
8244  $ @kbd{pdksh-5.2.14 lineno}  $ @kbd{pdksh-5.2.14 lineno}
# Line 8234  $ @kbd{pdksh-5.2.14 lineno} Line 8247  $ @kbd{pdksh-5.2.14 lineno}
8247  4. 2  4. 2
8248  6. 6  6. 6
8249  7. 0  7. 0
8250    8. 8 8
8251    9. $LINENO
8252    10. 10
8253    11. 10
8254    @end group
8255    @group
8256    $ @kbd{awk '/\$LINENO/@{printf "%d:", NR@}; @{print@}' lineno |}
8257    > @kbd{sed '/\$LINENO/s/^\([^:]*\):\(.*\)\$LINENO/\2\1/' |}
8258    > @kbd{sh}
8259    1. 1
8260    3. 3
8261    4. 4
8262    6. 6
8263    7. 7
8264    8. 8
8265    9. 9
8266    10. 10
8267    11. 11
8268  @end group  @end group
8269  @end example  @end example
8270    

Legend:
Removed from v.1.554  
changed lines
  Added in v.1.555

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26