Created
July 9, 2015 08:48
-
-
Save friek/2cdccea2701a6c6f96d4 to your computer and use it in GitHub Desktop.
bash prefix stdout/stderr of command output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Case 1: prefix stdout with 'test' | |
| exec 1> >(sed 's/^/test /') | |
| # Case 2: prefix a group of commands with 'test' | |
| { | |
| echo "prefixed line" | |
| } > >(sed 's/^/test /') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you! An alternative with Timestamp: https://gist.github.com/reduardo7/5d8443130495d3ad0e630eb344a37707