How do I write to a file and print to a terminal cuncurrently in Unix?
- by bias
I have a little bash function to log my Macports outputs to a file (since installs often spew little tidbits that are easy to lose in terminal noise), then I just cat the file to the terminal:
function porti {
command sudo port install $@ >> $1.log 2>&1; cat $1.log
}
Is there a way to do this concurrently?
I don't care about it being in Bash, that's just how I started it.
BTW I pass $@ to install but only $1 for the file name so that I can do something like:
porti git-gore +bash_completion
and only get the file git-core.log however someone else might prefer to include variants in the file name ...