On Sat, 16 Dec 2023 at 07:21, Giacomo Comes wrote:
> debugon () {
> trap 'if (($?)); then echo "$((LINENO-1)): $(sed -n "$((LINENO-1))p"
> "$0")" ; fi' DEBUG
> }
> debugoff () {
> trap '' DEBUG
> }
>
>
Although LINENO is the command that's about to be executed, that does not
imply that LI
2023年12月16日(土) 6:22 Giacomo Comes :
The original post asks the reason for the difference in the status
between the following two cases:
if ((0)); then :; else echo "here \$? is 1"; fi
if ((0)); then :; fi; echo "but here \$? is 0"
and the answer is that the former returns the status of ((0)) (wh
On Sat, 16 Dec 2023 00:09:10 +
Kerin Millar wrote:
> At this point, the value of $? is 1, prior to executing true - a simple
> command. Just as for any other simple command, the trap code shall be
> executed beforehand. Consequently, your test observes that $? is
> arithmetically false and
On Fri, 15 Dec 2023 17:21:23 -0400
Giacomo Comes wrote:
> Hi,
> I have stumbled upon a bug or something I don't understand while
> using the debug trap.
> Please run the script at the end.
> When debug is turned on, during its execution the program
> prints the line number and the line content wh
Hi,
I have stumbled upon a bug or something I don't understand while
using the debug trap.
Please run the script at the end.
When debug is turned on, during its execution the program
prints the line number and the line content which returned a non
zero value (error).
If you look at the script, the