Unix administration - Unix questions

This is Interesting: Free IT Magazines  
Home > Archive > Unix administration > September 2005 > Unix questions





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Unix questions
Herbert

2005-09-08, 5:54 pm

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

ted@loft.tnolan.com (Ted Nolan

2005-09-08, 5:54 pm

In article <1126212771.682168.196490@g14g2000cwa.googlegroups.com>,
Herbert <kang_uni@hotmail.com> 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
Bit Twister

2005-09-08, 5:54 pm

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.
Johan Wennerberg

2005-09-09, 7:50 am


"Herbert" <kang_uni@hotmail.com> wrote in message
news:1126212771.682168.196490@g14g2000cwa.googlegroups.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


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com