How do I create a shorthand for bash output redirection?
-
02-11-2019 - |
Question
I've been running a lot of similar commands lately, e.g.
python foo.py some args 2>&1 | tee foo.log
python bar.py otherarg 2>&1 | tee bar.log
To save typing, I'd like a shorthand for 2>&1 | tee
like
python foo.py some args $tee foo.log
but when I say export tee='2>&1 | tee'
, this gives me this error: Variable assignment '2>&1' invalid (no "=")
Is there a way to create a convenient shorthand (not necessarily identical to what I've written above) for this kind of output redirection?
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow