D&C Lug - Home Page
Devon & Cornwall Linux Users' Group

[ Date Index ][ Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] colour in bash print/echo statements?



Neil Williams wrote:

When you've got a bash script or perl script running in bash that produces reams of output (e.g. if you logged it all to a file it would be 30k per run) is there any way of adapting the script to produce certain sections in colour?




The short answer is yes :-)


e.g. critical error reports in red, success in green, warnings in magenta or cyan.



I would have thought that the colourising(?) method would depend on how you are viewing the log file. Are the lines flagged by keyword? If they are then it is probably easier to use a colourising viewer which would be configured to recognise the keywords.

I'm sure you could get Emacs to do this for you (it seems to do everything else!).

Try googling for "colorize log".

Cheers,

Pete

It would make it much easier to see what is going on.





--
The Mailing List for the Devon & Cornwall LUG
Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the
message body to unsubscribe.



Lynx friendly