Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 May 2003 09:35:49 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Fabian Haidekker <fhaidekk@rumms.uni-mannheim.de>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Shell scripts with Fn
Message-ID:  <20030521143549.GE26422@dan.emsphone.com>
In-Reply-To: <oprpidutcl99guk9@rumms.uni-mannheim.de>
References:  <oprpidutcl99guk9@rumms.uni-mannheim.de>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (May 21), Fabian Haidekker said:
> I wonder if I can execute self-written shell scripts by pressing one
> of the Fn keys? I am using Freebsd 5 and know how to change
> characters on my keymap, but need some help putting shell commands at
> certain keys if possible...

Depends on where you want the change.  You can remap the F-keys with
kbdcontrol, but they will not be useable as regular function keys in
any program anymore.  If your shell supports keybindings, you can bind
whatever you want to the F-keys in the shell, which won't affect other
programs.  Under zsh, for example, this makes the F1 key run the
command 'ls -ltr':

bindkey -s $termcap[k1] "ls -ltr^m"

Under /bin/sh, the syntax is similar, but you'll need to know the key's
escape code:

bind -s "\e[M" "ls -ltr^m"

-- 
	Dan Nelson
	dnelson@allantgroup.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030521143549.GE26422>