Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> 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?



Exactly -- 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


Ah, 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.


Probably implying use of `declare -pf` to turn functions into strings which can be evaluated by a remote shell.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: