vendredi 27 mars 2015

Why: Bash syntax error near unexpected token `fi'

so the error I'm getting is syntax error near unexpected token `fi' on the second last 'fi'. Been scratching my head for a while about this. Any help is greatly appreciated! Thanks!



#!/bin/bash

TFILE=/tmp/scripts/pdsh_demo.tmp
if [ -f $TFILE ]; then
rm $TFILE
fi
/usr/bin/pdsh -R ssh -w host[0001-0200] 'command | grep -v "something"' >> $TFILE

if [ ! -s $TFILE ]; then
exit
fi
if [ -f $TFILE ]; then
if grep -q "something" $TFILE ; then
grep -i "something" $TFILE | mailx -r "test.server" -s "Critical: something" -a $TFILE "test@test.com"
fi
fi

Aucun commentaire:

Enregistrer un commentaire