Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I've added

"\eOD": backward-word
"\eOC": forward-word

to my .inputrc to get ctrl-arrow key mappings sorted out in Cygwin allowing me to move forward and back fine.

When I SSH to any other Linux system, I lose this binding. Can anyone help?

I'm using PuTTYcyg 20101029, my terminal type is xterm, and I'm using Cygwin 1.7.9.

share|improve this question

migrated from stackoverflow.com Oct 28 '11 at 14:54

This question came from our site for professional and enthusiast programmers.

    
did you add these changes to the remote copy of .inputrc? Good luck –  shellter Oct 27 '11 at 15:33
    
If i add the above to the remote machine it works, but i have 50+ remote machines that i log on to with different users, that wouldn't be an easy solution for me. –  nickjb Oct 28 '11 at 9:51
3  
It would appear that when sshing, the shell you get is run on the remote machine, so it has no access to your local .initrc. I took a quick look through the ssh man page and didn't find a way to pass args to the remote shell, but perhaps you can search for one and alias it in your .bashrc. You could also write a script to append those lines to each of the remote machines' .initrc. –  Kevin Oct 28 '11 at 15:57
    
Thanks, i tried the same before i asked the question. There is no point fixing the remote machines because those machines change and are reinstalled regularly (test site) and also i don't want to go around modifying other machines user environments for my ease of use. I think there must be a cleaner way, i just wish i could find it. –  nickjb Oct 31 '11 at 11:35
    
@nickjb just write script which puts your .initrc/.bashrc on your remote machine and then makes real ssh. Then make alias ssh=${HOME}/bin/spam_ssh.sh on your script. –  Eir Nym Nov 19 '11 at 15:36
add comment

1 Answer 1

I also don't see any way to make ssh always run commands (e.g. bind -x '\eOD':backward-word etc.) whenever you log in, if you can't depend on maintaining files such as .bashrc, .intputrc, or .ssh/rc on the remote hosts. So how about this:

function ssh ()
{
  host=$1 ; shift
  scp ~/.inputrc $host:
  command ssh $host "$@"
}

This is kludgy and it will be a little slower, but it will give you your key bindings.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.