Instead of an alias, you can use a shell function, which bash
allows you to export. This way, you first define the function, then export its name, and finally start a new interactive shell which inherits your function. For example:
ssh -t name@ipAddress "short () { veryLongCommandThatIWriteOften; }; export -f short; bash"
The -t
is necessary to set up the pseudo terminal for the interactive bash
shell, as ssh
won't do it automatically for an apparently non-interactive command.
Note that you many need to be careful about quoting, depending on what the body of short
is.