Chet Ramey wrote:
On 6/6/13 6:48 PM, Linda Walsh wrote:
I wanted to test to see if a function was defined and looking at
typeset in the bash man page, I see
typeset ... The -p option will
display the attributes and values of each name. When -p is used
with name arguments, additional options are ignored. When -p is
supplied without name arguments, it will display the attributes
and values of all variables having the attributes specified by
the additional options. If no other options are supplied with
-p, declare will display the attributes and values of all shell
variables. The -f option will restrict the display to shell
functions. The -F option inhibits the display of function defi-
nitions;
ok ... so reading the above, how does "-f" and -F" tie in with
"-p" ?? If I use -f with -p does that limit it to functions only?
I think the original intent of the -p option was to have it interact with
-f and -F to limit each name argument to the function namespace, and to
display definitions and attributes. I will change the code and revise
the documentation to reflect that.
---
Yeah, right now, if you specify -f or -F with -p, it's as though
-p is ignored, whereas typeset -p by itself seems to give the attributes of -F
(non-funcs). I don't know how much it's worth, but it seems that
w/o -f or -F, -p might display attributes&values of funcs+vars,
with -f, funcs only, and -F as it acts now by itself (i.e. attribs of
func+vars).
Probably meant to do something orthogonal like that but maybe got
interrupted in the middle of implementation and the idea fell off "the stack"
so it never got completed....or at least I can see that happening to me...;-)