bash: "fill in the blank" alias that allows further typing -
background:
a well-known feature of bash "alias" command.
it allows user save keystrokes "abbreviating" frequently-used or annoying-to-type commands , executing them if user had typed in entire command herself , hit enter @ bash prompt.
problem:
the alias command automatically executes command corresponds alias after alias has been entered user. there may times when user not want behavior.
question:
is there way in bash create "fill-in-the-blank" alias commands? alias not automatically run command after hitting enter, instead gives user chance type argument.
pitfalls avoid:
ruled out reverse-i-search: "reverse-i-search" feature of bash supports "fill-in-the-blank" functionality request, (apparently) not allow user specify commands ahead of time, instead searching through history. may not desired behavior.
ruled out functions use of bash functions meet functionality request, may not desired solution because user may have reasons not wanting create function.
on second (and third , fourth) reading, think looking readline
function alias-expand-line
. it's not bound key default, more general shell-expand-line
pre-bound meta-control-e. type command line, , press instead of enter, , current command line expanded shell, not executed.
if don't want full expansion (parameters, history, etc) aliases, can use bind
command bind meta-control-e (or other key combination) alias-expand-line
, should expand aliases.
once expanded, can edit line desired, or use control-x control-e open current command line in $editor
more extensive editing.
Comments
Post a Comment