Skip to main content
20 events
when toggle format what by license comment
Apr 4, 2022 at 13:40 answer added Shakiba Moshiri timeline score: 1
Feb 28, 2022 at 17:23 answer added CIsForCookies timeline score: 0
Jul 2, 2020 at 13:54 answer added user8150417 timeline score: 3
Jul 9, 2019 at 21:21 answer added S0AndS0 timeline score: 18
Jun 4, 2019 at 11:19 answer added RichVel timeline score: 7
Mar 23, 2019 at 2:58 answer added sanmai timeline score: 3
Mar 7, 2019 at 1:02 answer added unpythonic timeline score: 17
Jul 4, 2017 at 9:34 answer added Andrew Ivanov timeline score: 33
May 30, 2012 at 14:21 vote accept Anthony Miller
May 30, 2012 at 7:37 answer added Mat timeline score: 103
May 29, 2012 at 23:56 comment added Gilles 'SO- stop being evil' @Mechaflash It would have to be trap 'echo $LINENO' ERR, with single quotes, not double quotes. With the command you wrote, $LINENO is expanded when line 2 is parsed, so the trap is echo 2 (or rather ECHO 2, which would output bash: ECHO: command not found).
May 29, 2012 at 23:55 history edited Gilles 'SO- stop being evil' CC BY-SA 3.0
deleted 36 characters in body
May 29, 2012 at 21:07 comment added Anthony Miller Didn't work. Still returned 2.
May 29, 2012 at 21:06 history edited Anthony Miller CC BY-SA 3.0
added 166 characters in body
May 29, 2012 at 19:43 comment added donothingsuccessfully Sorry, I borked the example line: trap 'echo $LINENO' ERR. The first argument to trap is the entire echo $LINENO hardquoted. This is in bash.
May 29, 2012 at 19:05 comment added Anthony Miller I'm so sorry... I didn't specify in my original question that I need a native solution. I edited the question.
May 29, 2012 at 19:04 history edited Anthony Miller CC BY-SA 3.0
added 53 characters in body
May 29, 2012 at 18:56 comment added Anthony Miller hmm just tried this with a bad echo | grep command and it returns the line of the Trap statement. But I'll take a look at bashdb
May 29, 2012 at 18:53 comment added donothingsuccessfully You can look at the bash debugger script bashdb. It seems that the first argument to trap can contain variables that are evaluated in the desired context. So trap 'echo $LINENO' ERR' should work.
May 29, 2012 at 18:23 history asked Anthony Miller CC BY-SA 3.0