Use "
instead of '
.
function txt_bold() {
echo -e "\033[1m$1\033[0m$2"
tput sgr0
}
Short
Within single quotes variables are not getting expanded.
Long
Below's the bottom line of this article, which might help you understand it: What’s the Difference Between Single and Double Quotes in the Bash Shell?
Double Quotes
- Use when you want to enclose variables or use shell expansion inside a string.
- All characters within are interpreted as regular characters except for $ or ` which will be expanded on the shell.
Single Quotes
- All characters within single quotes are interpreted as a string character.