The Elusive Command Alias Function?
Meph_the_Balrog asks: "I work as a helpdesk jockey for a company that manages over 1200 linux based servers, across a huge area. Currently we use a Windows SSH client to provide remote server support, and I don't have the weight to convince management to deploy alias scripts to all of the servers we support. I admit this question may seem frivolous to some, perhaps dangerous to others, so I have a twofold question. Do any of you out there use a Windows based SSH client that supports command aliasing? If you have strong objections to this sort of technology, what inherent problems do you see with it?"
Are you asking how to set up an alias kind of like this:
ruptime=`ssh $1 '/bin/uptime'`
Then when you want to check the uptime on a remote box, you run:
ruptime remote_host
And do all this from a Windows box?
If that's the case, you should use Putty. The Putty configuration can be set up to run a remote command, linked to a given hostname. Then when you open Putty, just select the proper 'alias' from the list, just like you would any host.
I would expect SecureCRT has a similar function, but I haven't used it in a few years.
God invented whiskey so the Irish would not rule the world.
Okay, I get it now. Here's what the guy wants:
He has no power to install his favored command aliases on all of the machine he has to administrate. He wants to have an SSH client (that he can run on Windows to connect to the Linux machines) that will interpret what he types and substitute aliases so that he doesn't have to set up his favored commands every time he logs into a system.
I don't know if you can set an SSH session into a line-based instead of keystroke-based communication mode. By default, it sends messages to the remote server after every keystroke and not after enter is hit at the end of a line -- otherwise using curses-based applications would really, really hurt as would using tab-completion, vi mode, and other advanced shell features. If this can't be done, then a client couldn't interpret your commands before you send them.
I don't forsee anyone providing this functionality because the demand is so low. This is the kind of thing that the remote end is expected to handle for you.
If it's for-profit but free, you're not the customer -- you're the product (e.g., the Slashdot Beta's "audience").
The type of interface you're thinking about is something along the lines of a text-based MUD or IRC client, where your commands are hooked BEFORE being sent to the server. I personally don't know of any, but can't imagine that it hasn't been considered. Currently, OpenSSH uses the "~" character to indicate that an SSH command will follow. "~C" drops you to an "ssh>" prompt to add things like tunneling while you're still connected to the host. Evidently, the ability to intercept input and redirect it to a local function is already built in to the software. IIRC, you can change the command character if "~" is too clunky for you. The next task is to extend this to provide an alias function. For example, you could bind "~a" to a theoretical "run-alias ALIAS ARGS" command. The desired effect is to output the expanded or constructed shell commands to the host. You will likely want to bind an interpreter to the run-alias command rather than creating your own. Find a license that is compatible with the OpenSSH client or whatever client you might be using.
assert(expired(knowledge));