I'm confused....I'm trying to make a little script on my Mandrake box in the bash shell. I admin AIX and use the ksh for my usual scripting, but seeing as they follow the same basics I figured this script would be easy...
What I got is the following:
Code:
DATE=`date +%H%M`
for i in `df -k -P | grep -v File | grep -v "/proc" | awk '{ print }'`
do
USAGE=`df -k -P | grep ${i} | awk '{ print $5 }'| sed s!%!!g`
INDEX=`mysql -D sysmon -e "select * from iostat" | awk '{ print }' | tail -1`
INDEX=`expr ${INDEX} + 1`
mysql -D sysmon -e "insert into iostat values ('${INDEX}', '${DATE}', '${i}', '${USAGE}') ;"
done
When I run this i get the following error:
Quote:
: command not foundine 20:
: command not foundine 21:
'/gather_data.sh: line 24: syntax error near unexpected token `do '/gather_data.sh: line 24: `do
|
Now if I run a simular for loop in a shell manually there are no problems....But I can't for the live of me figure out what I did wrong. Tried adding a few ';' here and there, but that didn't help.
Tried switching to use a temp file and load that into MySQL, but all temp files my script makes have na '?' behind the filename, so they get filled but I can't read them from the script....
Any clues how I can get this to work?