Delete function definition (equivalent to unalias)

I am currently creating a program that adds the current user shell depending on the project it is working on, by defining aliases and functions for each project. These aliases and functions can and certainly have the same name as, for example, cdproj , which will be cd for the project root.

I want to remove previously defined aliases and functions when a project changes (before (re) defining aliases and functions for another project. I know that I can delete an alias with unalias both bash and zsh, but how would I do the same for function?

+44
bash shell zsh
Jul 24 2018-11-11T00:
source share
2 answers
 unset -f my_function 

will remove (or disable) the my_function function

+65
Jul 24 2018-11-11T00:
source share

unfunction my_function in zsh

I may be a little late in this good old "15", but this function is preserved.

+9
Jul 08 '15 at 23:55
source share



All Articles