On Saturday, June 22, 2002, at 11:15 , David T-G wrote:
> ...and then Peter Scott said...
> %
> % At 09:37 AM 6/22/02 -0700, drieux wrote:
> ...
> % >that is in essence the Shell Debugger.
> % >
> % >Which really is not a 'realDebugger[tm]' because it really
> ...
> %
> % Eh?  The n and s commands do exactly that.  See also the r command.
>
> He didn't mean the perl debgger; he meant sh -x :-)

thank you - I'm sorry if it was not clear that one of
the limitations of the traditional

        sh -x MyScript.sh

is that about all you get is a 'trace' of what is going on -
which doesn't allow you to step through or over functions so
as to localize where an error may be occuring.

[..]
> % Tracing isn't generally as useful for a Perl script as for a shell
> % script because a shell script typically executes far fewer statements
> % than the average Perl script.  So the output can be unreasonably 
> verbose.
>
> Yeah.  What we really want is a command or flag that does exactly what -x
> does :-)  I forget whether or not -x stays on when you jump into a 
> function,
> but it would be nice to be able to watch perl do its thing and how it sees
> the vars that it's testing (in sh you get to see

in traditional /bin/sh it will walk into the function....

appended at the end is a case in point.

But unlike perl - there is no easy way to notice perse that one is
actually IN a function in a Shell Library - nor for that matter to
track down through what the Shell Library function does once it has
to invoke external code - which in this case is a perl script....

So While - Yes, that is a real Live Shell Library of functions, and
Yes, those are three "globals" that get defined in there = that you
see getting defined as we set the foo_g variables - I would not
recommend that strategy to anyone who can write Perl Code.

ciao
drieux

---
vladimir: 57:] cat !$
cat ScaryCode.sh
#!/bin/sh

LIB="/net/gax/home/drieux/lib/mt_lib/dnlLib"
if [ -f $LIB ]
then
         . $LIB
else
         echo "unable to find our Library"
         exit 7
fi
# one of the functions in that /bin/sh library
DNL_match_token_to_ip_for_list "Frodo" "wetware gax bopper"

exit
vladimir: 58:] sh -x ScaryCode.sh
LIB=/net/gax/home/drieux/lib/mt_lib/dnlLib
+ [ -f /net/gax/home/drieux/lib/mt_lib/dnlLib ]
+ . /net/gax/home/drieux/lib/mt_lib/dnlLib
dnl_switching_g=SW_SERV|DC_SERV
dnl_billing_g=FP_SERV|DB_SERV
dnl_services_g=SW_SERV|DC_SERV|FP_SERV|DB_SERV
+ DNL_match_token_to_ip_for_list Frodo wetware gax bopper
TOKEN=Frodo
LIST=wetware gax bopper
+ echo wetware gax bopper
+ get_ip wetware
ipaddr=199.108.16.1
+ echo Frodo 199.108.16.1
Frodo 199.108.16.1
+ get_ip gax
ipaddr=199.108.16.8
+ echo Frodo 199.108.16.8
Frodo 199.108.16.8
+ get_ip bopper
ipaddr=199.108.16.4
+ echo Frodo 199.108.16.4
Frodo 199.108.16.4
+ exit
vladimir: 59:]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to