we have the follwing array - list1 and list2

list1="node23 node76 node 34"
list2="node02 node2 node9 node21"

we want to bold the list2 so list1 will printed without bold and list2 with bold


echo ${list1[*]}  ${list2[*]}

node23 node76 node 34 node02 node2 node9 node21

so how to insert tput bold in echo so list2 will be bold?

  1. tput bold - will bold the words

  2. tput sgr0 will return the bold to normal



echo ${list1[*]}  "$(tput bold)" ${list2[*]} "$(tput sgr0)"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.