3 ms·
> You can even export functions over ssh! What does "export" mean in this context? Do you just mean `ssh host cmd` where cmd is some shell that happens to cont
by throwawaygh 5y ago
> You can even export functions over ssh!
What does "export" mean in this context? Do you just mean `ssh host cmd` where cmd is some shell that happens to contain (and call) a function?
- xyzzy_plugh 5y agoProbably implying use of `declare -pf` to turn functions into strings which can be evaluated by a remote shell.
- chaps 5y agoExactly -- check out script in the link, it shows how it would be used. I'm not sure why the first `remote_cmd` is called (probably local testing and forgot to delete it), so ignore that. Try this and you'll see how it returns a dramatic amount of bash as its output: remote_cmd="`typeset -f` ; function test123 { echo hi! ; }" && echo -e $remote_cmd
- throwawaygh 5y agoAh, makes sense! Yeah, that's nice. You can do something similar with scripting languages by piping source code into the interpreter. Super useful back in the day for doing crap on machines in an LSF cluster when the NFS was down/slow.