In bash I can do:foo() { echo bar; }export -f fooperl -e 'system bash -c foo'I can also access the function definition:perl -e 'print foo.$ENV{BASH_FUNC_foo%%}'How do I do the same in fish?Edit:With this I can get the function definition:functions -n | perl -pe 's/,/\n/g' | while read d; functions $d; endIf I can put that in an enviroment variable accessible from Perl, I ought to be able to execute that before executing the command. So similar to:setenv funcdefs (functions -n | perl -pe 's/,/\n/g' | while read d; functions $d; end)perl -e 'system($ENV{funcdefs},foo)'But it seems setting funcdefs ignores the newlines: $ENV{funcdefs} is one horribly long line.The odd part is that it seems fish does support environment variables containing newlines:setenv newline 'foobar'echo $newlineCan I encourage fish to put the output from the command into a variable, but keeping the newlines?
Accessing fish functions from perl
shell;function;fish
Ugly as hell, but works:function foo  echo bar;endsetenv funcdefs (functions -n | perl -pe 's/,/\n/g' | while read d; functions $d; end|perl -pe 's/\n/\001/')perl -e '$ENV{funcdefs}=~s/\001/\n/g;system (fish, -c, $ENV{funcdefs}.foo)'