Re: Bash/readline enhancement: wish to pre-set initial value of input te
From:
Jan Schampera
Subject:
Re: Bash/readline enhancement: wish to pre-set initial value of input text
Date:
Tue, 08 Jul 2008 06:29:55 +0200
User-agent:
IceDove 1.5.0.14eol (X11/20080509)
Richard Neill wrote:
> Dear All,
>
> When using read, it would be really neat to be able to pre-fill the form
> with a default (or previous) value.
>
> For example, a script which wants you to enter your name, and thinks
> that my name is Richard, but that I might want to correct it.
> Alternatively, this would be useful within a loop, to allow correction
> of previously-entered text, without fully typing it again.
A bit of the functionality (in some way) is already there. You can
preload the commandline history and use read -e:
--snipsnap--
If -e is supplied and the shell is interactive, readline is used to
obtain the line.
--snipsnap--
A bit of hard work, though.
J.