Unix questions - Unix

This is a discussion on Unix questions - Unix ; Hello, Could anyone answer the following questions? 1. What methods can you use to capture/recover from errors in your scripts? 2. How will you get the shell to output each line before execution in order to help debugging? Many thanks ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Unix questions

  1. Unix questions

    Hello,

    Could anyone answer the following questions?

    1. What methods can you use to capture/recover from errors in your
    scripts?
    2. How will you get the shell to output each line before execution in
    order to help debugging?

    Many thanks in advance!

    Regards
    Herbert


  2. Re: Unix questions

    In article <1126212771.682168.196490@g14g2000cwa.googlegroups. com>,
    Herbert wrote:
    >
    >
    >Hello,
    >
    >Could anyone answer the following questions?
    >
    >1. What methods can you use to capture/recover from errors in your
    >scripts?
    >2. How will you get the shell to output each line before execution in
    >order to help debugging?
    >
    >Many thanks in advance!
    >
    >Regards
    >Herbert
    >


    1. Check the exit status of commands you run.

    2. Use the -x flag to the shell


    Ted

  3. Re: Unix questions

    On 8 Sep 2005 13:52:51 -0700, Herbert wrote:
    > Hello,
    >
    > Could anyone answer the following questions?
    >
    > 1. What methods can you use to capture/recover from errors in your
    > scripts?


    I test status return code and call a function with error and message.
    Function would email a message with repair procedure.

    > 2. How will you get the shell to output each line before execution in
    > order to help debugging?


    depends on the shell, sh, ksh, csh,....

    I use
    set -vx
    to start watching code run and
    set - to stop showing what is going on.

    echo statement to display variable contents if desired.

  4. Re: Unix questions


    "Herbert" wrote in message
    news:1126212771.682168.196490@g14g2000cwa.googlegr oups.com...
    > Hello,
    >
    > Could anyone answer the following questions?
    >
    > 1. What methods can you use to capture/recover from errors in your
    > scripts?
    > 2. How will you get the shell to output each line before execution in
    > order to help debugging?
    >
    > Many thanks in advance!
    >
    > Regards
    > Herbert
    >


    1. Try "trap"

    2. sh -x

    BR Johan W



+ Reply to Thread