[ale] bash script problem

ale list ale at gurlhax0r.org
Fri Dec 15 16:23:10 EST 2006


Charles Shapiro wrote:
> Uuh, except I don't think "host" is gonna know the word "CMD".

Try this, it appears to work. Note the double quotes around CMD in the 
ssh command:

#!/bin/sh

CMD="if [ -e /var/lib/clamav/daily.cvd ]; then
     ls -al /var/lib/clamav/daily.cvd
else
     echo
fi"

me=`hostname`

set -x
for host in `cat ~/.hosts`; do
    echo -n "$host       ";
    if [ $host = $me ]; then
         $CMD
    else
        ssh $host "$CMD"
    fi
done

--
Tina



More information about the Ale mailing list