Quote:
Originally Posted by Billy_6052
ive created a script where I want to grep out any error messages and colour the word 'error'.
|
Luckily nobody has ever done this before! ;-p
Any particular reason not to use the (previously suggested) multitail, ctail or ccze?
Quote:
Originally Posted by Billy_6052
the script I have made so far is:
Code:
#!/bin/bash
cat /var/log/messages | grep --color=always "error" | tail
when I run the script there is no output.
|
Instead tail a file ('man tail') then grep for it:
Code:
tail -f /var/log/messages | grep --color=always "error"
Quote:
Originally Posted by Billy_6052
also I want to use a loop so I am able to chose wheather I want to look in the /var/log/messages or /var/log/boot.log.... is that possible?
|
Either select files by providing them as argument to your script, by using a selector with say "getopts" (in BASH shell: 'help getopts') or use "select" (in BASH shell: 'help select').
*Also note this about the 3rd or 4th thread on the same subject so please keep your topic in one place from now on, OK?