views:

78

answers:

1

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?

+2  A: 

You need to use " instead of '.

So it should be: echo -e "\033[1;32m$x:\033[0m";

Variables are generally interpolated inside double quotes.

webdestroya
Awesome! That worked great!.
drewrockshard
Cool, just be sure to mark the question as answered after the time limit
webdestroya