[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to print the actual command for BASH_COMMAND in trap?
From: |
Koichi Murase |
Subject: |
Re: How to print the actual command for BASH_COMMAND in trap? |
Date: |
Sun, 13 Jun 2021 22:33:41 +0900 |
2021年6月13日(日) 22:08 Peng Yu <pengyu.ut@gmail.com>:
>
> OK. If there is no way to show BASH_COMMAND as the actual commands run
> in trap, then I want to know it is in trap so that I can just ignore
> BASH_COMMAND. Is there a way to test whether it is in trap or not?
> Thanks.
I guess you want to detect whether the DEBUG target is in another trap
handler or not from inside the DEBUG trap handlers? Hmm, I don't have
an idea. What I can come up with now is an ugly hack something like
trap '{ false; exec {flag_trap}>&-; flag_trap=; } {flag_trap}> /dev/null' EXIT
trap '[[ ! $flag_trap ]] && declare -p BASH_COMMAND' DEBUG
true
--
Koichi
- How to print the actual command for BASH_COMMAND in trap?, Peng Yu, 2021/06/12
- Re: How to print the actual command for BASH_COMMAND in trap?, Koichi Murase, 2021/06/12
- Re: How to print the actual command for BASH_COMMAND in trap?, Peng Yu, 2021/06/12
- Re: How to print the actual command for BASH_COMMAND in trap?, Koichi Murase, 2021/06/13
- Re: How to print the actual command for BASH_COMMAND in trap?, Alex fxmbsw7 Ratchev, 2021/06/13
- Re: How to print the actual command for BASH_COMMAND in trap?, Alex fxmbsw7 Ratchev, 2021/06/13
- Re: How to print the actual command for BASH_COMMAND in trap?, Koichi Murase, 2021/06/13
- Re: How to print the actual command for BASH_COMMAND in trap?, Alex fxmbsw7 Ratchev, 2021/06/13
- Re: How to print the actual command for BASH_COMMAND in trap?, Peng Yu, 2021/06/13
- Re: How to print the actual command for BASH_COMMAND in trap?,
Koichi Murase <=
Re: How to print the actual command for BASH_COMMAND in trap?, ikhxcsz7y xmbott, 2021/06/13