[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: |
ikhxcsz7y xmbott |
Subject: |
Re: How to print the actual command for BASH_COMMAND in trap? |
Date: |
Sun, 13 Jun 2021 10:20:26 +0200 |
1. you cannot set bash cmd for executement like this
2. try the code as PS0 var
On Sun, Jun 13, 2021, 04:32 Peng Yu <pengyu.ut@gmail.com> wrote:
> 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, 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, 2021/06/13
Re: How to print the actual command for BASH_COMMAND in trap?,
ikhxcsz7y xmbott <=