View Single Post
  #6   (View Single Post)  
Old 1st December 2008
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,128
Default

  1. Alternative 1
    Code:
    if [ ! -z "$result" ] ; then
        echo "$check found"
    else
        echo "$check not found"
    fi
  2. Alternative 2, which is used heavily in the OpenBSD rc scripts
    Code:
    if [ "X${result}" != "X" ] ; then
        echo "$check found"
    else
        echo "$check not found"
    fi
  3. Alternative 3
    Code:
    if test grep "$check" "$FILE" >/dev/null 2>&1 ; then
        echo "$check found"
    else
        echo "$check not found"
    fi
    This third alternative is the one I would use

Re: Resources

Don't forget examples like the startup/boot scripts in FreeBSD and NetBSD. By studying them I learned a lot about shell scripting.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote