Hi!
----
Is there a way that I can call two functions for a (DEBUG) trap ?
Example:
-- snip --
% cat /tmp/traptest.ksh93
function dlog
{
typeset -i stat=$?
echo "ksh_foo $LOGNAME $$" Status $stat PWD $PWD \'${.sh.command}\'
}
function dlog2
{
typeset -i stat=$?
echo "ksh_bar $LOGNAME $$" Status $stat PWD $PWD \'${.sh.command}\'
}
trap dlog DEBUG
trap dlog2 DEBUG
/bin/echo "hello"
ls >/dev/null
/bin/echo "world"
# EOF.
% ksh /tmp/traptest.ksh93
ksh_foo test001 32139 Status 0 PWD /home/test001 'trap dlog2 DEBUG'
ksh_bar test001 32139 Status 0 PWD /home/test001 '/bin/echo hello'
hello
ksh_bar test001 32139 Status 0 PWD /home/test001 'ls'
ksh_bar test001 32139 Status 0 PWD /home/test001 '1> /dev/null'
ksh_bar test001 32139 Status 0 PWD /home/test001 '/bin/echo world'
world
-- snip --
The problem is that I defined the function "dlog" for the DEBUG trap and
then like to call the function "dlog2", too. But in the example above
the 2nd call to "trap" simply supersets the first DEBUG trap function.
My idea was to provide a way to install some kind of debug facility on
demand for the ksh93 migration in Solaris, e.g. to have a way to catch
and monitor scripts which are deeply hidden in some products (even if
they use the DEBUG trap for their own work).
----
Bye,
Roland
--
__ . . __
(o.\ \/ /.o) roland.mainz at nrubsig.org
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 7950090
(;O/ \/ \O;)