I have a lot of echo and command execution inside my bash file and I wanted to store those outputs to a file. Initially I am using
./myscript.sh | tee -a log.txt to log but I am exploring the possibly to achieve this inside the bash file. Some articles suggests doing this
echo "Successfully executed" >> /path-to-logfile but I have a lot of lines and this would be cumbersome. How could I achieve this with fewer commands/lines?
And at the start of the script, it also checks if the log folder exists