[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] read -ep and ANSI colour sequences

From: John Kearney
Subject: Re: [Help-bash] read -ep and ANSI colour sequences
Date: Wed, 20 Feb 2013 21:59:43 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130107 Thunderbird/17.0.2

Am 20.02.2013 11:01, schrieb muji:

I would like to use ANSI colour sequences when showing a prompt using
read -ep but I can't figure out how to do this. Is this possible? Am I
missing something? Using standard escape sequences does not appear to
work, my current test code looks like:

read -ep "\033[1mABC\033[0m" value;

Using echo -e the output is bold as expected:

echo -e "\033[1mABC\033[0m";

I cannot see any option in `bash help read` that affects ANSI escape
sequences. I suspect escaping is different in this instance, but my
experiments have not yielded anything so far. Any pointers much

check out

it solves your problems in 2 ways
it creates variables with the color escape sequences.
2 options using tput or using the ansi escape sequences directly.

read -ep "\033[1mABC\033[0m" value;

read -p "${ATTRIB_Bold}ABC${NO_COLOUR}" value;

This version is bash secific but I should have some more generice code lying around if that is an issue.


View John
          Kearney's profile on LinkedIn John Kearney

reply via email to

[Prev in Thread] Current Thread [Next in Thread]