在fishshell中,我可以非常轻松地创建和保存函数,例如:
function aaa
echo hello
end
funcsave aaa
但是如何轻松地从命令行查看函数aaa
的主体?有什么办法除了:
echo ~/.config/fish/functions/aaa.fish
答案 0 :(得分:18)
functions aaa
username@MacBook-Pro ~> functions aaa
function aaa
echo hello
end
username@MacBook-Pro ~>
functions -n
# Displays a list of currently-defined functions
functions -c foo bar
# Copies the 'foo' function to a new function called 'bar'
functions -e bar
# Erases the function `bar`
答案 1 :(得分:11)
此外,type aaa
将显示函数定义,并带有一些前导码:
$ type aaa
aaa is a function with definition
function aaa
echo hello
end