Please let me know if there is a more appropriate community for this question.
I can do:
$] printf "\033[1;32mtext\n"
and it returns
text ←colored green
I can do:
$] printf "\033[1;32m" ; printf "green text"
and it returns
green text ←colored green
But if I do:
$] printf "\033[1;32m"
$] printf "green text"
I get
green text ← NOT colored green
Is there a way of changed all output to a color until I reset it with
$] printf "\033[0m"
I’m trying to color my script’s output for several lines, then changing it back. I thought something like:
$] printf "\033[1;32m"
$] printf "Some statement colored green"
$] printf "Another statement colored green"
$] function () ⇽ return from function, also colored green
$] printf "\033[0m" ← return to default terminal colors
You must log in or # to comment.
Never mind, I’m an idiot.
The following worked for me in my script
GREEN='\033[1;32m' NC='\033[0m' printf $GREEN print various things printf $NC
I’m not even sure where I was having issues at this point.