删除函数定义(等效于非别名) [英] Remove function definition (unalias equivalent)

查看:54
本文介绍了删除函数定义(等效于非别名)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在构建一个程序,该程序通过定义每个项目的别名和函数,根据他正在从事的项目添加到当前用户的外壳程序中.这些别名和函数可能并且肯定会具有与例如 cdproj 之类的相同名称,该名称会 cd 到项目的根.

I'm currently building a program which adds to the current user's shell depending on the project he's working on, by defining per-project aliases and functions. These aliases and functions may and will certainly have the same name like for instance cdproj, which would cd to the project's root.

我想在更改项目时删除之前定义的别名和函数((为(再))定义另一个项目的别名.我知道我可以在bash和bash中都使用 unalias 删除别名zsh,但是我该如何对某个函数执行相同操作?

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

推荐答案

unset -f my_function

将删除(或取消设置)函数my_function

will remove (or unset) the function my_function

这篇关于删除函数定义(等效于非别名)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆