27

In fishshell, I can create and save a function very easy, like:

function aaa
   echo hello
end

funcsave aaa

But how to view the body of the function aaa from command line easily? Is there any way other than:

echo ~/.config/fish/functions/aaa.fish
Freewind
  • 193,756
  • 157
  • 432
  • 708

2 Answers2

36

invoke functions aaa on command line

username@MacBook-Pro ~> functions aaa
function aaa
    echo hello
end
username@MacBook-Pro ~>

Some more uses of functions command

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`
sdayal
  • 1,126
  • 10
  • 16
21

Also, type aaa will show you the function definition, with a bit of a preamble:

$ type aaa
aaa is a function with definition
function aaa
    echo hello
end
glenn jackman
  • 238,783
  • 38
  • 220
  • 352