By default if we run
foo(){
echo "myfoo"
}
it will go to stdout. My question is, for a bash script or function, is there a programmatic way to change the device so that commands don't automatically write to stdout?
maybe something like this:
foo(){
mkfifo bar
exec 1<>bar
echo "myfoo" # this gets written to the bar named pipe?
}
so we "repoint" stdout somewhere else perhaps?
tail -f bar
I don't seem to get any data there. – Alexander Mills May 08 '18 at 04:40foo >bar
? – Kusalananda May 08 '18 at 04:58