I know how to redirect output to Linux. The thing is, I have a lot of output in my bash script, and I don't want to enter something like
echo $foo >> bar
again and again. I would rather do something like:
hey, bash, for the time being put all your STDOUT in "bar" echo $foo . . OK, bash, you can go back to regular STDOUT now
I tried to open FD 1 as a file:
exec 1>bar
but I could not return STDOUT to normal when it was done. File closing
exec 1>&-
gave me errors that I could not get around.
How to do it? Thanks!
bob.sacamento
source share