required operation bash command example result
find unique lines sort | uniq cat file.txt | sort | uniq all unique lines from file – sort is necessary – "uniq" can eliminate duplicities only in following lines until next different line
log stdout and strerr into text file tee
LOG=myinstall.log
touch $LOG
exec > >(tee -a $LOG)
exec 2>&1
These commands must be somewhere at the beginning of the script. All messages produced by script will be displayed on screen and also logged into text file