Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.
both outputs; on screen and to file.log:
' command '2>&1 | tee -a file.log
$HOME/bin/shell_script.sh >/home/usr/test.log 2>&1
We can run the script using and redirect the output to a file rather than to the screen.
Ex: ./script.sh > /home/dir1/file1 We are executing the script and saving the output to a file called file1
The oup\\tput can be save in a new directory using redirecting symbol >>
First capture the output of the script using a backtick and then pipe it into an echo command which writes into a specified file in a specified directory.
$ ./yourscript.sh > output.txt$ /path/to/your/script.sh > output.txt
do something like this ./script.sh > /tmp/output.log 2>&1