Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've never used PuTTY. But in bash, the syntax I gave you is correct. I don't know what key has the code \x59. Incidentally, \x59 specifies 59 hex, not 59 decimal.
To test your setup, try:
bind -x '"H": "echo hello"'
After than, capital H should result in hello being echoed to the console. If it doesn't, then we have a problem. BTW, when trying the syntax I gave you, did the shell complain? If the syntax is correct, you should see no response to the bind command. Also, if immediately after issuing the bind command you execute
echo $?
It should echo '0' if the bind command succeeded. If it doesn't, then the command failed.
Two questions about this?
1) How do you 'unbind'? for instance if you do
Code:
bind -x '"H": "echo hello"'
and later you want to use the 'H', how do you recover it? I tryed several things but it doesn't works, in fact all becomes worst
2) Where can I find the code of every key?
Regards
Where nnn is replaced by the octal for the H key keycode, which I don't know.
But, theres an easy way: exit the shell. Bindings are not persistent nor global, they are local to the instance of bash in which you excecuted the bind command.
To unbind H you would have to bind using the form
bind '"\nnn": self-insert'
Where nnn is replaced by the octal for the H key keycode, which I don't know.
I found the codes; for instance they are in the book of Paul Sheer ("LINUX: Rute user's...") page 38. (They are the ascii codes, of course... or this is what I think)
But I cannot unbind. I did what you said: first
Code:
bind '"\110":"echo hello"'
('\110' is the code for 'H')
second
Code:
bind '"\110":echo hello'
and now when I press 'H' I get nothing (well, I get 'beep')
I tryed many combinations... and it doesn't work (the same happens if I type 'H' instead of the code) It always gets worst and worst
Code:
But, theres an easy way: exit the shell. Bindings are not persistent nor global, they are local to the instance of bash in which you excecuted the bind command.
Well, I know, but it is not very elegant, is it?
Any idea?
Regards
Yep, what I said should work, thats bind 'self-insert' to the H key. The bindings take emacs and vi functions. The 'self-insert' function means insert the value of the key, i.e., in your case 'H'. So:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.