How to see / Check the Step by Step Execution of a Shell Script for Debugging?

It is very important have the step by step execution feature for debugging for any kind of programming language. Using this feature you can see the variable values which are getting assigned during the script execution. In shell script you can use the –x option to see the step by step execution. See an example here.


I have a sample program here.
cat tst.sh
echo "Test Program"
read a
echo $a
if [ $a -eq 1 ]
then
echo "One"
else
echo $a
fi
See the execution here
$ ksh -x tst.sh
+ echo 'Test Program'
Test Program
+ read a
1
+ echo 1
1
+ [ 1 -eq 1 ]
+ echo One
One  

DBA Tips Data Pump Reference

0 comments:

Post a Comment

 

dba topics. Copyright 2011-16 All Rights Reserved | Site Map | Contact | Disclaimer | Google