Akim Demaille wrote: > Le 6 juil. 2012 à 15:21, Stefano Lattarini a écrit : > >> Why not shave off the extra forks here? >> >> printf "$me: $warnf_format_" "$@" >&2 >> >> This shouldn't cause problems, unless '$me' contains '%' or '\' characters. > > Or end of line. Elsewhere, where I use similar routines, > it is useful to be able to output an error/log message from > a tool for instance, which may be multiline. > > In that case I prefer to keep the original formatting, but > prepend the name of the tool on each line.
You're welcome to leave the pipe-to-sed. Worrying about an extra process when processing a diagnostic is probably a pre-optimization anyhow. Besides, then we don't have to worry about whether $me is printf-safe. Thanks.