bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: typeset -p & manpage on it are confusing w/rt funcs


From: Greg Wooledge
Subject: Re: typeset -p & manpage on it are confusing w/rt funcs
Date: Fri, 7 Jun 2013 08:15:50 -0400
User-agent: Mutt/1.4.2.3i

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]