Bash Color Variable Output

Posted by drewrockshard on Stack Overflow See other posts from Stack Overflow or by drewrockshard
Published on 2010-05-13T18:27:15Z Indexed on 2010/05/13 18:34 UTC
Read the original article Hit count: 186

Filed under:
|
|

I've got a variable, let's say $x and it holds the value of website.com. I want to be able to call the variable and apply shell color to it like so:

echo -e '\033[1;32m$x:\033[0m';

The problem is not the color, however, it's how the script it interpretting the output. So the output I'm getting is:

$x:

I need the output to obviously be the string in the variable, and not the variable name. Is there any way around this issue?

© Stack Overflow or respective owner

Related posts about bash

Related posts about color