When I execute grep
from within gnome-terminal, I get colored output - easily noticeable match, line-numbers (-n) with different colors etc
But when I execute exactly same grep
command through bash script I get plane output, without coloring
Is there a way I can get colored output by using bash script?
Using the
--color
option works for me out when I run grep inside of shell scripts.Here is an example of what you want.
Here's a small script that helps you to grap how tput works with bash
This will print the following output with formats like BOLD ,UNDERLINE , Highlighting and colors.
Did you tried to add these alias to your
~/.bashrc
?