如何列出我的Shell中定义的功能? [英] How do I list the functions defined in my shell?

查看:56
本文介绍了如何列出我的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 the declare builtin command (see Bash Builtins). The -F option to declare will list the function names only (and optionally the source file and line number).

Bash参考手册

这篇关于如何列出我的Shell中定义的功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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