helpThe GNU Bourne-Again SHell - Support: sr #109140, Builtin read should support escape...

 
 

sr #109140: Builtin read should support escape sequences for prompt (-p)

Submitted by:  Maxxim <maxxim>
Submitted on:  Sun 11 Sep 2016 12:18:06 PM UTC  
 
Category: NonePriority: 5 - Normal
Severity: 1 - WishStatus: Done
Privacy: PublicAssigned to: None
Open/Closed: OpenOperating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Sun 25 Sep 2016 04:28:58 PM UTC, comment #2:

Bash-4.4 provides a general solution to this using the new
${param@P} expansion.

Chet Ramey <chet>
Project Administrator
Sun 11 Sep 2016 12:32:22 PM UTC, comment #1:

I'm using Bash 4.3_p42 on Gentoo Linux (x64) which lacks the feature, just in case it already got added in later version.

Maxxim <maxxim>
Sun 11 Sep 2016 12:18:06 PM UTC, original submission:

The Bash builtin 'read' does currently not support the use of escape sequences with the option '-p' (prompt).

Although there are workarounds to make read -p print escape sequences, e.g.

# read -p $'\033[1minput>\033[0m '

or

# prompt=$(echo -e "\033[1minput>\033[0m ")
# read -p "$prompt"

these don't work too well as they tend to screw up things when using option '-e' (readline) and the cursor keys to bring up elements from the command history.

It would be great if the read builtin would support escape sequences natively, probably on an on-demand basis, i.e. an additional option that allows enabling escape sequences like it is the case with 'echo' (option '-e').

Maxxim <maxxim>

 

(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 (Posted a comment)
  • -unavailable- added by maxxim (Submitted 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):

     

     

    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 25 Sep 2016 04:28:58 PM UTCchetStatusNone=>Done

    Back to the top


    Powered by Savane 3.1-cleanup1