[clug] Next in my series of "how to do things in /bin/sh that you probably shouldn't".

Andrew Janke a.janke at gmail.com
Wed Aug 19 19:09:28 MDT 2009


> Not that I've tried it, but using process substitution to get bash to
> automatically do the pipe magic might work?
>
>    exec > >(tee logfile.txt) 2>&1

Hrm, this certainly works as a bash script but the prompt is ahead of
itself after running it?  I suspect as the script finishes and the
prompt is returned before the tee is. I'd have to add a wait on the
tee (presuming I can get its PID) at the end I would guess.

Still a whole lot shorter!


a


More information about the linux mailing list