Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Prefix stdout/stderr with a static prefix.
- #
- # e.g:
- # $ static_prefix "[Hi there] " ls /
- # [Hi there] bin
- # [Hi there] boot
- # ...
- # [Hi there] vmlinuz
- static_prefix() {
- local PREFIX
- local COMMAND
- PREFIX=$1
- COMMAND=${@:2}
- $COMMAND \
- 1> >(sed >&1 "s#^#$PREFIX#") \
- 2> >(sed >&2 "s#^#$PREFIX#")
- }
Add Comment
Please, Sign In to add comment