我知道我可以用来unset -f $FUNCTION_NAME
在 bash / zsh 中取消设置单个函数,但是如何取消设置所有函数?
在zsh
shell 中,您可以使用禁用所有功能
disable -f -m '*'
Run Code Online (Sandbox Code Playgroud)
(字面意思是“禁用名称匹配的每个函数*
”)。
然后您可以通过类似的enable
调用再次启用它们。
您也可以unset
以类似的方式使用从当前环境中完全删除函数:
unset -f -m '*'
Run Code Online (Sandbox Code Playgroud)