I want to prepend something to each line of output in a script, for every command.
I was thinking of doing something like this:
rm foo mkfifo foo exec 3<>foo cat <&3 | while read line; do if [[ -n "$line" ]]; then echo " [prepend] $line"; fi done & echo "foo" >&3 echo "bar" >&3 echo "baz" >&3
basically for all commands I want to prepend something to each line of the output. My code above is fairly bogus, but I don't quite know how to do it, it's something like the above but not quite.