> Discipline Functions.
> Each variable can have zero or more discipline functions
> associated with it. The shell initially understands the
> discipline names get, set, and unset but on most systems
> others can be added at run time via the C programming
> interface extension provided by the builtin built-in utility.
> I don't quite understand how you'd define a discipline function.
> Anyone?
is invoked anytime vname=value is accessed. The unset function
is invoked anytime unset vname is invoked. Here are functions
I use in profiling a shell script:
PROFILE=0
function profile
{
# set up profiling
PROFILE=0
SECONDS=0
export PS4='l=$LINENO t=$PROFILE: '
}
function PROFILE.get
{
((.sh.value = int(1000*SECONDS),SECONDS=0))
}
Now to profile a patch of code, I surround it with
set -x and set +x.
--
Dan Mercer
Opinions expressed herein are my own and may not represent those of my employer.