How to have a shell script available everywhere I SSH to

Posted by aib on Super User See other posts from Super User or by aib
Published on 2011-02-24T22:34:10Z Indexed on 2011/02/24 23:27 UTC
Read the original article Hit count: 282

Filed under:
|
|

I have a shell script which I simply cannot do without: bar from Theiling Online

I use SSH a lot and on a variety of *nix servers. However, I am not a system administrator and usually don't have the time or privileges to install it on every server I connect to.

It is apparently a very portable sh script and has command line options to export itself as a shell function, which got me thinking: Could I use one of OpenSSH's subjectively obscure features to export it everywhere I go?

My first thought was to assign the source to an environment variable like BAR = "cat -v" and then execute it on the other side as `$BAR`, but 1) I can't even get the cat example to to work locally, 2) I don't know how to put the script's actual multiline source into an environment variable and 3) I have yet to see a machine with PermitUserEnvironment enabled.

I guess I could even do with an ssh option to write a file called ~/bar at logon, but a more volatile solution would be better.

Calling wget http://.../bar at logon would be unacceptable.

Any ideas?

P.S. Putty-specific solutions, though I doubt any would exist, are also fine.

© Super User or respective owner

Related posts about linux

Related posts about ssh