In the answer to this question, it uses the following (simplified):
echo "this is $(tput bold)bold$(tput sgr0) but this isn't"
But that tput sgr0
resets all of the text attributes.
I'd like to output coloured text, with only some of it in bold. So I want something like this:
echo "$(tput setaf 1)this is red; $(tput bold)this is bold; $(tput unbold)this is red, but not bold"
But tput unbold
isn't a thing.
Is there any way to push/pop the terminal attributes so that I could do something like the following?
echo "$(tput setaf 1)this is red; $(tput push; tput bold)this is bold; $(tput pop)this is red, but not bold"