I want to bold one word in shell script. I want the value for num bold when it is inputted. My code does not bold the value. It's like its not even there.
echo -n "Please read a number"
read num ; echo "${bold} $num ${offbold}"
Thank you,
Ccccc
I want to bold one word in shell script. I want the value for num bold when it is inputted. My code does not bold the value. It's like its not even there.
echo -n "Please read a number"
read num ; echo "${bold} $num ${offbold}"
Thank you,
Ccccc
For this to work the shell variables "${bold}" and "${offbold}" would need to contain the control codes which cause your terminal to turn on/off bold type. They are not commands.
Do you mean something such as this?
bold=`tput smso`
offbole=`tput rmso`
read num ; echo "${bold} $num ${offbold}"
smso changes the background on mine. I just did this in a script a few days ago and used "tput bold" and "tput sgr0" to turn it back to normal. I don't know what the difference is, I just ran across the commands somewhere and tried them.
echo "notbold $(tput bold) bold $(tput sgr0) notbold"
I made a little script to show me all the colors. Here is the output (png image) with examples of all the colors I had at the time.
Dear Friend,
You can use the following.
Example
echo -e "\e[1;01mThis is bold text.\e[0m"
Another Example
echo "Please read a number"
read num
echo $num;
echo -e "\e[1;01m $num \e[0m"
If you want more details see the following URL
http://webhome.csc.uvic.ca/~sae/seng265/fall04/tips/s265s047-tips/bash-using-colors.html
Hi,
Using the following program you can display the bold number.
tput clear
echo -n "Enter the number:"
read num
echo "Number with bold"
echo "----------------"
tput bold
echo "$num"
tput reset