On Thu, Jun 06, 2013 at 03:48:09PM -0700, Linda Walsh wrote:
> I wanted to test to see if a function was defined
imadev:~$ unset foo
imadev:~$ foo=variable
imadev:~$ bar() { echo I am a function; }
imadev:~$ declare -f foo >/dev/null 2>&1 ; echo $?
1
imadev:~$ declare -f bar >/dev/null 2>&1 ; echo $?
0
> and looking at
> typeset in the bash man page, I see
imadev:~$ help typeset
typeset: typeset [-aAfFgilrtux] [-p] name[=value] ...
Set variable values and attributes.
Obsolete. See `help declare'.
But "typeset" does work in place of "declare" in the examples above.
They appear to be interchangeable, for now, in this particular case.