在fishshell中,我可以非常轻松地创建和保存函数,例如:
function aaa
echo hello
end
funcsave aaa
Run Code Online (Sandbox Code Playgroud)
但是如何aaa从命令行轻松查看函数体?有什么办法除了:
echo ~/.config/fish/functions/aaa.fish
Run Code Online (Sandbox Code Playgroud)
sda*_*yal 24
functions aaa在命令行上调用username@MacBook-Pro ~> functions aaa
function aaa
echo hello
end
username@MacBook-Pro ~>
Run Code Online (Sandbox Code Playgroud)
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`
Run Code Online (Sandbox Code Playgroud)
gle*_*man 16
此外,type aaa将向您展示函数定义,并带有一些前言:
$ type aaa
aaa is a function with definition
function aaa
echo hello
end
Run Code Online (Sandbox Code Playgroud)