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 number
value_returned=$(search $number)
echo "$value_returned"