0

I'm running a script on a Bourne shell, eg not bash (actually the sh from BusyBox 1.23.2).

As asked & answered in this question, I'd like to "catch" error messages issued by commands within my script, and preappend a string to have them stand out in the log file.
However contrary to the answer provided in the linked question, I cannot use process substitution because the shell is not bash.

I'm redirecting all outputs to a log file:

#exec 3>&1 4>&2 >>$LOGFILE 2> >(sed 's/^/ *** ERROR:  /' >&1)
#  -->  -sh: syntax error: unexpected redirection
exec 3>&1 4>&2 >>$LOGFILE 2>&1
luneart
  • 101

0 Answers0