grep in a variable

view full story

http://www.unix.com – Hello, I usually search extensively and have to date found what I've needed. However, this one's got me stumped. I need to create a variable as follow. The issue however is that upon execution, it freezes. $var1 isn't always present in usage.log and this is fine but I'd like it to continue with the script if no match is found. Any ideas? Thanks. Code: var2=`grep $var1 /conf/usage.log | tail -1 | cut -d " " -f 2` (HowTos)