4 ms·
In this example? It's clearly useless and somewhat tongue-in-cheek. Redirecting stdout has some straightforward uses, e.g. log(){ foo "$1"
by xelxebar 2y ago
In this example? It's clearly useless and somewhat tongue-in-cheek. Redirecting stdout has some straightforward uses, e.g.
log(){
foo "$1"
bar "$2"
} >>logfile
Redirecting stdin is a little more subtle:
contents(){
maybeReadStdinA
maybeReadStdinB
} <input
where the first command to read stdin gets the contents of input and subsequent commands see nothing.