だから私が得ているエラーは、最後から2番目の「fi」の予期しないトークン「fi」の近くの構文エラーです。これについてしばらく頭を悩ませていました。どんな助けでも大歓迎です!ありがとう!
#!/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