So I found a way to transfer environment variables through ssh without having to change neither server nor client: Transferring environment variable through SSH / quoting in bash/sh/csh/tcsh
But I would also like to be able to transfer bash functions like this one:
$ myfunc() {
> echo Func $1
> }
$ export -f myfunc
$ parallel myfunc ::: a
Func a
Functions are not transferred through ssh:
$ parallel -S server myfunc ::: a
bash: myfunc: command not found
$ parallel --env myfunc -S server myfunc ::: a
bash: line 2: myfunc: command not found
But the content of the function is transferred nicely:
$ parallel --env myfunc -S server echo \$myfunc ::: a
() { echo Func $1} a
So it seems all I need to do now is to somehow tell bash that $myfunc is really the function myfunc.
How can I do that?