Print Hello World In Different Color

echo Command

All the parameters to the echo command are printed on the screen. with the help of echo command, we can print the text in a different color.

#!/bin/bash
echo this is gaurav sharma
echo 'this is our first                 shellscript'
echo -e "\033[0;31m fail message"
echo -e "\033[0;32m success message"
echo -e "\033[0;33m warning message here"

now lets run the above script

┌──(gaurav㉿learning-ocean)-[~/shellscript-youtube]
└─$ ./echo.sh
this is gaurav sharma
this is our first                 shellscript
fail message here
success message here
warning message here

you will see fail message here in red color, success message here in gree color, warning message here in yellow color.

Demo Video

Click Here for Demo Video