Redirect echo output in shell script to logfile
I tried to manage using the below command. This will write the output in log file as well as print on console.
#!/bin/bash# Log Location on Server.LOG_LOCATION=/home/user/scripts/logsexec > >(tee -i $LOG_LOCATION/MylogFile.log)exec 2>&1echo "Log Location should be: [ $LOG_LOCATION ]"
Please note: This is bash code so if you run it using sh it will through syntax error