[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bash/readline enhancement: wish to pre-set initial value of input te
Re: Bash/readline enhancement: wish to pre-set initial value of input text
Tue, 08 Jul 2008 06:29:55 +0200
IceDove 220.127.116.11eol (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:
If -e is supplied and the shell is interactive, readline is used to
obtain the line.
A bit of hard work, though.