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

 
 

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

Submitted by:  None
Submitted on:  Wed 09 Nov 2005 03:59:11 AM UTC  
 
Category: NonePriority: 5 - Normal
Severity: 1 - WishStatus: Done
Privacy: PublicAssigned to: None
Originator Email: -unavailable-Open/Closed: Open
Operating System: GNU/Linux

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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:
/home/rjn/Bethoven

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] : "
INITIAL_VALUE=$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.

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 04 Jan 2016 02:04:25 PM UTCchetStatusNone=>Done
    Wed 09 Nov 2005 03:59:12 AM UTCNoneCarbon-Copy-=>Added rn214 --AT-- cam --DOT-- ac --DOT-- uk

    Back to the top


    Powered by Savane 3.1-cleanup