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:  None Priority:  5 - Normal
Severity:  1 - Wish Status:  Done
Privacy:  Public Assigned to:  None
Open/Closed:  Open Operating 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 '


# 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:

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)

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

    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.3