Using linux script command Using linux script command shell shell

Using linux script command


if you use sh -x to run your script it will print the commands or addset -x to your script.

script -c "sh -x ./test.sh" reult.log

sample output:

+ dateTue Dec 23 09:52:22 CET 2014+ ls -la


 set -o verbose

Execute this on terminal before executing your script or add this at the beginning of the script.

This will change the terminal configuration to echo all the commands before executing them.

This will add the command then followed by the output of that command.

you can also use :

 set -x or set -v set -xv

-x option enables variable expansion and echo's all the option used with the command.

-v is similar to -o verbose this simply echo's the command name

-xv echo's both.