All pastes #977723 Raw Edit

Bash script

public shellscript v1 · immutable
#977723 ·published 2008-04-09 01:00 UTC
rendered paste body
root@starchild:/tmp# cat fwlogsearch2.sh #!/bin/bash# Searches FW logs on Linode, which are contained in /var/log/messages* files        function search {                local ip  #ip is local to the function                echo "Searching... "                echo " "                grep "$ip" /var/log/messages*                #cat /var/log/messages* | grep $ip                wordcount=`grep -c "$ip" /var/log/messages*`                #wordcount=`cat /var/log/messages* | grep $ip | wc -l`                echo "The number of instances this IP shows in the logs is $wordcount "        }echo "Type in a number to search."read numbervalue_returned=$(search $number)echo    "$value_returned"