[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How to print the actual command for BASH_COMMAND in trap?
From: |
Peng Yu |
Subject: |
How to print the actual command for BASH_COMMAND in trap? |
Date: |
Sat, 12 Jun 2021 21:32:07 -0500 |
In the following script, 'true' is printed twice.
My understanding is that, for trapped command ('false' in this),
BASH_COMMAND is still the last command before the trap ('true'). Is it
the case?
$ ./main.sh
declare -- BASH_COMMAND="true"
declare -- BASH_COMMAND="true"
$ cat ./main.sh
#!/usr/bin/env bash
trap 'false' EXIT
trap 'declare -p BASH_COMMAND' DEBUG
true
Is there a way to print 'false' instead of 'true' for the last print
of BASH_COMMAND?
--
Regards,
Peng
- How to print the actual command for BASH_COMMAND in trap?,
Peng Yu <=
- 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, 2021/06/13
Re: How to print the actual command for BASH_COMMAND in trap?, ikhxcsz7y xmbott, 2021/06/13