Re: Re: Bash "read" command: want to preload some data
Won't this do what you want? It obviously works on "old" bash.
echo -n "prompt:"; writevt -t `tty` -T "default"; read a;
For example:
testuser@bartlett:~$ echo -n "prompt:"; writevt -t `tty` -T "default";\
> read a; declare -p a BASH_VERSION
prompt:default
declare -- a="default"
declare -- BASH_VERSION="3.1.17(1)-release"
testuser@bartlett:~$
testuser@bartlett:~$
testuser@bartlett:~$ echo -n "prompt:"; writevt -t `tty` -T "default";\
> read a; declare -p a BASH_VERSION
prompt:something else
declare -- a="something else"
declare -- BASH_VERSION="3.1.17(1)-release"
testuser@bartlett:~$
Sorry to take so long to respond; we've had a large team working on this
question full-time to develop this "solution". :-)
Reply to: