如何列出我的Shell中定义的功能? [英] How do I list the functions defined in my shell?
问题描述
我可以输入别名以显示所有别名的列表.
I can type alias to show a list of all the aliases.
但是对于功能,我所能做的就是grep我的.bash_profile
.
But for functions, all I can do is grep my .bash_profile
.
那只会获取该文件中的文件,而不是在子文件中定义的文件或动态获取的文件.
That only gets the ones in that file, not those defined in subsidiary files or dynamically.
是否有更方便的方法来找出当前定义的功能?
Is there a more convenient way to find out what functions are currently defined?
推荐答案
declare -F
函数名称和定义可以通过
-f
选项列出.declare
内置命令(请参阅Bash内置文件).declare
的-F
选项 仅列出功能名称 (以及源文件和行号(可选)).
Function names and definitions may be listed with the
-f
option to thedeclare
builtin command (see Bash Builtins). The-F
option todeclare
will list the function names only (and optionally the source file and line number).
这篇关于如何列出我的Shell中定义的功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!