bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

read & presetting the text to read


From: Johannes Zellner
Subject: read & presetting the text to read
Date: Tue, 12 Jun 2001 19:51:06 +0200
User-agent: slrn/0.9.7.1 (Linux)

Hi,

I've a shell script which uses

#v+
    default=bla
    read -e -p "some prompt [$default] " reply
    if test "x" != "x${reply}"; then
        echo "${reply}"
    else
        echo "${default}"
    fi
#v-

now I'd rather like the $default to be stuffed into readline's
input line which is possible in readline AFAIK, but I don't know
how to do it in bash.

Example: I'd like to have a prompt and a preset text like this:

#v+
    prompt> this text should be editable
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#v-

where the cursor is behind the end of the line and everything which is
underlined is editable and returned in the variable 'reply'.

Is this possible with bash and how ?

Any help much appreciated.

-- 
   Johannes



reply via email to

[Prev in Thread] Current Thread [Next in Thread]