Let's say I have two scripts, one calls the other, how can I prepend text to each echo to visually indicate the echo comes from the called command?
a.sh
#!/usr/bin/env sh
echo - BEGIN
./b.sh # Append "-" to each echo?
echo - END
b.sh
#!/usr/bin/env sh
echo - BEGIN
echo - END
Output I want:
- BEGIN
-- BEGIN
-- END
- END
I can't touch b.sh and I need to stream the output.
b.sh
contained a command other thanecho
and the command generated output? In general do you want the whole output fromb.sh
to be modified? or just output fromecho
s? – Kamil Maciorowski Mar 16 '23 at 19:43