How can I Debug a shell scripts and Perl scripting??
or How do you debug a shell scripting and perl scripting (
at the compile time error or run
time error) in Unix environment ?

Answers were Sorted based on User's Feedback



How can I Debug a shell scripts and Perl scripting?? or How do you debug a shell scripting and per..

Answer / hema

Using sh -x script argument you can debug(-x option).
Bash shell offers debugging options which can be turn on or
off using
set command.
=> set -x : Display commands and their arguments as they are
executed.
=> set -v : Display shell input lines as they are read.

Hope this answers your question.

Is This Answer Correct ?    12 Yes 1 No

How can I Debug a shell scripts and Perl scripting?? or How do you debug a shell scripting and per..

Answer / manas

We can debug only by $? which contains the returned value
of last executed command.

If $? contains 0 value then command run successfully other
wise error occured while running command

Is This Answer Correct ?    3 Yes 2 No

How can I Debug a shell scripts and Perl scripting?? or How do you debug a shell scripting and per..

Answer / sushil

In addition to Hema's ans :
We can have some $? statement, echo statements embadded in
script.
In pern we can use -w option to print the warning or erros
generated during compilation, can make use os strict to force
to use good programming practice...

Is This Answer Correct ?    0 Yes 1 No

How can I Debug a shell scripts and Perl scripting?? or How do you debug a shell scripting and per..

Answer / ram

We can also use below command to debug the script
bash -xv <scriptname.sh>

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More Shell Script Interview Questions

Why are shell scripts used?

0 Answers  


Where cron file kept?

2 Answers   Tech Mahindra,


Hello all, This is my assignment on shell scripting, can anyone help me regarding this ? Create a shell script which connects to the database In second shell script include the first script for the DB connection Create a table (PRADEEP_DATA) with 2 columns (name, value) In Third shell script include the first script for the DB connection And insert/delete the values from the Table, by accepting input from the user This functionality should be a menu driven Program: 1) Insert to the database a. Name b. value 2)Delete from the database a.Name b.value Exception handling needs to be taken care.

0 Answers   Cap Gemini, Wipro,


write a shell script to identify the given string is palindrome or not?

17 Answers   CTS, HP, IBM, InfoEst, Wipro,


how to find weblogic version through linux cammand

1 Answers   L&T,






What are environment variables?

2 Answers  


Why is a script important?

0 Answers  


how to read systems current date and time

4 Answers  


Tell something about the super block in shell scripting?

0 Answers  


Why is shell scripting important?

0 Answers  


how to delete all the files with extension .dat rom a directory tree from root to third level in a single unix command?

4 Answers  


How will you connect to a database server from linux?

0 Answers  


Categories