Re: Bash "read" command: want to preload some data
On Sat, Mar 06, 2010 at 09:44:13 -0600, Boyd Stephen Smith Jr. (bss@iguanasuicide.net) wrote:
> PROMPT="stuff"
> DEFAULT="path"
>
> printf '%s [%s] ?' "$PROMPT" "$DEFAULT"
> read FILEPATH
> if [ -z "$FILEPATH" ]; then
> FILEPATH="$DEFAULT"
> fi
Boyd and André - thank you both for your suggestions, which are probably
as good as it well get, without the -i functionality in bash4 (assuming
I stick to bash - Ron's hint re python noted). To be of use to me, I
really want the ability to edit the existing text when it is offered to
the user and I think an upgrade to bash 4 is going to be worth a try as
this is just a part of a quite big bash script which I have been
constantly tweaking for years.
Thanks again.
--
Bob Cox. Stoke Gifford, near Bristol, UK.
Please reply to the list only. Do NOT send copies directly to me.
http://bobcox.com/
Reply to: