Hello good day
I would like to know what is the difference between these two commands please
both warrant the output in the file
echo " ORACLE_SID : $ORACLE_SID" | tee -a $logfile
echo " ORACLE_SID : $ORACLE_SID" > $logfile
Hello good day
I would like to know what is the difference between these two commands please
both warrant the output in the file
echo " ORACLE_SID : $ORACLE_SID" | tee -a $logfile
echo " ORACLE_SID : $ORACLE_SID" > $logfile
The -a
options of tee
appends the output to the file rather than overwriting the file.
Your > $logfile
code overwrites the file.
There may be more subtle differences I am not familiar with off the top of my head.
tee
works like a plumber's T-piece that allows gas or water flow split into two directions. tee
accepts input on stdin and, on top of writing it to stdout, also writes / appends to one or several additional files. Your first version will append to a log file (create if non-existent) but also print to screen (or whatever stdout is at the time the snippet runs).
Thank you very much, this information helped me a lot!