Script Help

karlp at ourldsfamily.com karlp at ourldsfamily.com
Wed Nov 8 22:14:16 UTC 2006


Okay, I use bash scripts for my CGI and I have a page I'd like to get "real"
counts on, so I wrote a script that has a whole bunch of && line extensions.

I'd like to write a script that could be called with a single environment
variable assigned a value and have it return either true or false, with
another variable set with an error or response of some type.

What would the syntax be to check a bunch of conditions and exit on the first
match rather than hitting every 'if'

IE:

PV=`echo $HTTP_USER_AGENT|grep msnbot` ; processvar
(or Gigabot or WISEnutbot or inktomisearch, etc.)
processvar

where processvar now =

processvar () {
 if [ "$PV" = '0' ] ; then ;# control number only
  cat $FNM | mail -s "Access to $ACCESS" karlp ;# to send email to me
 else
  cat $FNM | mail -s "WebBot Access to $ACCESS" karlp
  PV=0
 fi
}

Currently my syntax results in as many positive hits (and the resultant emails
about a WebBot) as I have search engines I trace.

Frankly, I could go back to the previous syntax, but it's very annoying to add
things to. I'd like to get to the point where I put a search phrase in a file
and do a   for i in $VAR..do loop

Help?

-- 
karl
     _/  _/      _/      _/_/_/       ____________   __o
    _/ _/       _/      _/    _/     ____________  _-\<._
   _/_/        _/      _/_/_/                     (_)/ (_)
  _/ _/       _/      _/           ......................
 _/   _/ arl _/_/_/  _/ earson    KarlP at ourldsfamily.com
---
Senior Consulting Sys/DB Analyst
http://consulting.ourldsfamily.com
---
 My Thoughts on Terrorism In America right after 9/11/2001:
 http://www.ourldsfamily.com/wtc.shtml
---
 The world is a dangerous place to live... not because of
 the people who are evil, but because of the people who
 don't do anything about it.
 - Albert Einstein
---




More information about the Redhat-install-list mailing list