mainThe GNU Readline library - Support: sr #104820, Wish: set initial contents of line...


sr #104820: Wish: set initial contents of line buffer to be edited

Submitter:  None
Submitted:  Wed 09 Nov 2005 03:59:11 AM UTC
Category:  None Priority:  5 - Normal
Severity:  1 - Wish Status:  Done
Privacy:  Public Assigned to:  None
Originator Email:  -email is unavailable- Open/Closed:  Open
Operating System:  GNU/Linux
* Mandatory Fields

Add a New Comment Rich Markup

Wed 09 Nov 2005 03:59:11 AM UTC, original submission:  

In the script I am writing (to rip oggs), I am trying to get data from the user.

So the first time round, it does:
   PROMPT="Enter Destination Directory [$OUTPUTDIR] : "
   read -er -p "$PROMPT" OUTPUTDIR

The user sees:
  Enter Destination Directory [] :

At this point, the user might type:

Now, after all the data has been input, I go round one more time, and ask the user to confirm:

PROMPT="Enter Destination Directory [$OUTPUTDIR] : "
read -er -p "$PROMPT" OUTPUTDIR

The user sees:
   Enter Destination Directory [Bethoven] :

And the user must then either press enter to confirm (I treat an empty string as acceptance of the value), or type "Beethoven" to correct the entry.

What I would like to have is the initial contents of the editable line specified. Eg:
   PROMPT="Enter Destination Directory [$OUTPUTDIR] : "
   read -er -p "$PROMPT" -i "$INITIAL_VALUE" OUTPUTDIR

The user then sees:
  Enter Destination Directory [Bethoven] : Bethoven

where the second "Bethoven" is already in the input buffer, ready to be edited. This makes it much quicker to correct - instead of having to type the full word, the user can simply use readline's editing facilities to correct the line.

I hope that helps - it would be really useful to me, and probably many others.




(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by chet (Updated the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-01-04 chet StatusNone Done
    2005-11-09 None Carbon-Copy- Added rn214 --AT-- cam --DOT-- ac --DOT-- uk

    Back to the top

    Powered by Savane 3.12.
    Corresponding source code