help-bash
[Top][All Lists]
Advanced

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

[Help-bash] eval and LINENO


From: Peng Yu
Subject: [Help-bash] eval and LINENO
Date: Thu, 15 Nov 2018 14:26:08 -0600

 Hi,

For the 2nd eval in main1.sh, the LINENO is not at the actual line
number of the eval command. This behavior is counter-intuitive. Would
it be better to make it show the line number of the 2nd eval? Thanks.

$ cat script.sh
#!/usr/bin/env bash
# vim: set noexpandtab tabstop=2:

echo "$LINENO"


$ cat main1.sh
#!/usr/bin/env bash
# vim: set noexpandtab tabstop=2:

eval '#!/usr/bin/env bash
# vim: set noexpandtab tabstop=2:

echo "$LINENO"


'
eval "$(< ./script.sh)"
echo "$LINENO"

$ ./main1.sh
13
14
12


-- 
Regards,
Peng



reply via email to

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