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

 
 

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

Submitter:  Maxxim <maxxim>
Submitted:  Sun 11 Sep 2016 12:18:06 PM UTC
   
 
Category:  None Priority:  5 - Normal
Severity:  1 - Wish Status:  Done
Privacy:  Public Assigned to:  None
Open/Closed:  Open Operating System:  GNU/Linux
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group 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 Files:
   
   
Comment:
   

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

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-09-25 chet StatusNone Done

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code