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

What is web script?

0 Answers  


How do I run a .sh file on mac?

0 Answers  


How would you compare the strings in a shell script?

0 Answers  


How can the contents of a file inside jar be read without extracting in a shell script?

0 Answers  


Give some situations where typing error can destroy a program?

0 Answers  






Devise a script that takes file name as arguement(which must present in the current directory)and locates from your home directory tree all thpath names of its links.Then mail the list to self.

0 Answers  


What is Linux language details

0 Answers   Quick Heal,


How to include comments in your shell scripts?

3 Answers  


What can scripts do?

0 Answers  


how to get part of string variable with echo command only?

0 Answers  


What is the first line of a shell script called?

0 Answers  


HOW TO CREATE 10 USERS IN UNIX(HP-UX) USING SHELL SHELL SCRIPT?

3 Answers   Patni,


Categories