bug-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] Bash Trap: How to Get Line Number of a Subprocess with N


From: Steve Amerige
Subject: Re: [Help-bash] Bash Trap: How to Get Line Number of a Subprocess with N
Date: Fri, 30 Dec 2016 07:58:36 -0500
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

I've updated the stackoverflow <http://stackoverflow.com/questions/41346907/bash-trap-how-to-get-line-number-of-a-subprocess-with-non-zero-status> question with more info.

I also tested:

     1  #!/bin/bash
     2  shopt -s extdebug
     3  main() {
     4  trap 'echo $LINENO' ERR
     5  $(exit 17)
     6  }
     7  main

The above also has the desired output of 5.

So, either form of command substitution gives the desired result, but using a subshell as in:

    (exit 17)

does not give the desired LINENO result.




reply via email to

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