Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I do 'if X is a function, unfunction it' ?

3 views
Skip to first unread message

Timothy J Luoma

unread,
May 1, 1998, 3:00:00 AM5/1/98
to zsh-...@math.gatech.edu

Pretty much says it all.

for example, if the command 'cp' has been previously defined as a function,
then I want to unfunction it

TjL

Bart Schaefer

unread,
May 1, 1998, 3:00:00 AM5/1/98
to Timothy J Luoma

On May 1, 11:45am, Timothy J Luoma wrote:
> Subject: How do I do 'if X is a function, unfunction it' ?

>
> for example, if the command 'cp' has been previously defined as a function,
> then I want to unfunction it

You mean, without getting a "no such hash table element" warning?

How about

function unfunction() {
for i; do
function $i () { }
builtin unfunction $i
done
}


Zoltan Hidvegi

unread,
May 1, 1998, 3:00:00 AM5/1/98
to Timothy J Luoma

> for example, if the command 'cp' has been previously defined as a function,
> then I want to unfunction it

[[ `type cp` == *' function' ]] && unfunction cp

This works unmodified in ksh too.

Zoli


0 new messages