use function keys in bash

Chris F.A. Johnson c.f.a.johnson-bJEeYj9oJeDQT0dZR+AlfA at public.gmane.org
Mon Feb 23 00:53:57 UTC 2004


On Sun, 22 Feb 2004, Lennart Sorensen wrote:

> On Thu, Feb 19, 2004 at 08:19:06PM -0500, Jeremy Wakeman wrote:
> > I have used tcsh for several years, but I am tired of having to relearn
> > commands/syntax/settings/rc files everytime I use a linux box that does
> > not have tcsh installed.  So, I am in the process of switching to bash.
> > The one thing that I cannot seem to get bash to do that tcsh does is to
> > execute a command when I press a function key.
> >
> > In my .tcshrc, I have several entries as follows:
> >
> > bindkey -c [18~ "screen -d -r mutt || screen -S mutt mutt"
> > bindkey -c [19~ "screen -d -r mang || screen -S mang mang"
> > bindkey -c [21~ "screen -d -r mp3blaster || screen -S mp3blaster mp3blaster -a ~/.playlist_01.lst -t=500"
> > bindkey -c [23~ "screen -d -r topcheck || screen -S topcheck topcheck"
> > bindkey -c [24~ "screen -list"
> >
> > With this setup, I can just press F7 to call forward the mutt screen (or,
> > start one if there isn't one running), F10 for mp3blaster, etc.
> >
> > I read through the readline stuff in bash(1), but I don't see anything
> > about executing non-builtin commands, and none of the things I tried in
> > .inputrc worked.
> >
> > Is there a way to do this, or am I stuck?
>
> Well you can certainly do this in .inputrc:
>
> "\e[11~": "ls\n"
>
> And it works when you hit F1 to print that text on the command line.
>
> Of course you have to logout and back in for bash to read the file
> again.

    No need to log out. ^X^R rereads .inputrc

-- 
	Chris F.A. Johnson
	=================================================================
	cfaj-uVmiyxGBW52XDw4h08c5KA at public.gmane.org                      http://cfaj.freeshell.org
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list