Tools to debug

Posted on 2006-04-30
Last Modified: 2013-12-27
Could someone tell me what tools I can use to debug shell scripts?  
Question by:Higante
    LVL 10

    Assisted Solution

    Depends what shell.   The Bource shell derivatives (sh, ksh, bash) have the -v and -x switches.

    You can see more on ksh debugging here:

    Perl has the Perl debugger:  perl -d .....  << this rocks

    I don't use csh so I can't say how to debug it ... csh needs a bullet in the head.
    LVL 38

    Accepted Solution

    Please tell us the with shell you are using for scripting.

    For sh/ksh/bash script you can add the following line as the 2nd line of your script:

    set -x  

    make your script looks like:

    set -x

    #your main script goes to here

    For csh, it is possible to debug a script by adding the -x flag to the shell executable
       % csh -x scriptname arguments

    I sugest you to use ksh or sh for scripting, please read this " Csh Programming Considered Harmful":


    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. Please see for the updated article. It is avail…
    Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap ( Version 1.2 2.      Jpcap( Version 0.6 Prerequisite: 1.      GCC …
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
    In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    25 Experts available now in Live!

    Get 1:1 Help Now