[Top][All Lists]

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

Line counting is ideosyncratic with eval.

From: dfsmith
Subject: Line counting is ideosyncratic with eval.
Date: Wed, 22 Sep 2021 11:27:06 -0700

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2 -fdebug-prefix-map=/build/bash-2bxm7h/bash-5.0=. 
-fstack-protector-strong -Wformat -Werror=format-security -Wall 
-Wno-parentheses -Wno-format-security
uname output: Linux porter 4.19.0-13-amd64 #1 SMP Debian 4.19.160-2 
(2020-11-28) x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 5.0
Patch Level: 3
Release Status: release

        When running commands through eval, the script's line counter
        is incremented, even though the eval line is fixed.

        The error in this 6-line script is reported as being at line 1006.

        $ cat x.sh

        set -eu
        unset heavy_cargo
        many_lines=$( for((i=0; i<1000; i++)); do echo ":"; done; echo "echo 
\$heavy_cargo" )
        eval "$many_lines"

        $ ./x.sh
        ./x.sh: line 1006: heavy_cargo: unbound variable

reply via email to

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