I am trying to use grep to color some log files . I wrote a script and a part of it looks like this :
#!/bin/bash
com="GREP_COLOR=\"1;36\" egrep --color=always '[^a-zA-Z0-9]' $log |less -R"
log="/var/log/syslog"
eval $com
The execution was missing $log !
I tried this :
#!/bin/bash
com="`GREP_COLOR=\"1;36\" egrep --color=always '[^a-zA-Z0-9]' $log |less -R`"
log="/var/log/syslog"
eval $com
Nothing happened !
Could you see any mistake in my code ?