help-bash
[Top][All Lists]
Advanced

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

[Help-bash] How to get the whole pipeline command?


From: Peng Yu
Subject: [Help-bash] How to get the whole pipeline command?
Date: Tue, 4 Dec 2018 11:16:02 -0600

Hi,

In the following example, since the error is from the pipeline, I'd
expect the whole pipeline is printed. But it only prints the last
command in the pipeline, which actually finished correctly.

Is there a way to get the whole pipeline command ("false | true" in
this case)? Thanks.

$ cat main.sh
#!/usr/bin/env bash
# vim: set noexpandtab tabstop=2:

trap 'echo The running command is: "address@hidden"' ERR
false | true
set -o pipefail
false | true
$ ./main.sh
The running command is: true

-- 
Regards,
Peng



reply via email to

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