2

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?

1 Answer 1

5

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Cool, just be sure to mark the question as answered after the time limit

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.