If I have a shell script myscript.sh, and I execute it using myscript.sh > myscript.out 2>&1 all works fine.
Is there a way to tell the shell to echo each command that it executes within that script to the output file also?
e.g if the script contains the commands
I'd like the script to echo the command to the o/p file as it runs through each one. At the moment I have to do
Greg.
Is there a way to tell the shell to echo each command that it executes within that script to the output file also?
e.g if the script contains the commands
Code:
whoami
rm afile
Code:
echo "whoami"
whoami
echo "rm afile"
rm afile