[KLUG Members] help with bash script error

Richard Harding rick at ricksweb.info
Mon Sep 12 10:38:18 EDT 2005


I'm trying to setup this code that will merge mailgraph with cacti for
postfix for me and I've gotten so close (his setup was FreeBSD and I'm
on debian), but I have one error I can't figure out.

I'm not a bash master, but it seems like this should work from the
documentation on loops I can see online. 

The script is:
 
#!/bin/bash
for i in sent received rejected bounced spam virus;
do
    c=$(/bin/cat /var/tmp/mail$i)
    result="${result} ${i}:${c}"
    echo 0 > /var/tmp/mail$i
done
echo $result

I'm getting the error:
'ostfixstats.sh: line 2: syntax error near unexpected token `
'ostfixstats.sh: line 2: `for i in sent received rejected bounced spam
virus;

Am I missing something on how the for loop should look?

Thanks for any help. 

Rick



More information about the Members mailing list