[ale] bash script problem

Charles Shapiro hooterpincher at gmail.com
Fri Dec 15 16:52:34 EST 2006


Okay, so you have all the pieces, right?


#!/bin/sh

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

me=`hostname`

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





On 12/15/06, Jim Popovitch <jimpop at yahoo.com> wrote:
>
> On Fri, 2006-12-15 at 16:23 -0500, ale list wrote:
> > 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:
>
> :-) That works for ssh, but the "if" error is back for the local system.
> Strange that #!/bin/sh (and even #!/bin/bash) doesn't work.
>
> Still, thanks for the suggestions.
>
> -Jim P.
>
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
>
-------------- next part --------------
An HTML attachment was scrubbed...




More information about the Ale mailing list