Are you trying to run this as a Bash script with *#!/bin/bash* (or some
from of Bash)?
or are you trying to run this as a Bourne shell with *#!/bin/sh* (or some
form of Borne)?

-> Jake


On Tue, Nov 12, 2013 at 9:01 AM, Raymond Norton <admin at lctn.org> wrote:

> I run the following script to test if a host is on-line and trigger a back
> up if it's alive. Something apparently changed with the script and it is
> giving me a "unary operator expected" error for line 17.
>
> Any ideas what is triggering it?
>
>
>
> if [ -f /etc/bacula/ping_check.txt ];
> then
>      FILEDATE=`cat /etc/bacula/ping_check.txt`
> else
>      FILEDATE=0
> fi
>
> if [ $NOWDATE -ne $FILEDATE ];
> then
>      if [[ $CMD_RET =~ ", 0% packet loss" ]]
>      then
>           echo "$HOST pinged ..."
>           echo $NOWDATE > /etc/bacula/ping_check.txt
>         # run backup script
>          /etc/bacula/backup-host-1
>
>      else
>           echo "$HOST did not ping ..."
>      fi
> fi
>
> exit
>
> --
> Raymond Norton
> LCTN
> 952.955.7766
>
> Sent from My Desktop
>
> _______________________________________________
> TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
> tclug-list at mn-linux.org
> http://mailman.mn-linux.org/mailman/listinfo/tclug-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.mn-linux.org/pipermail/tclug-list/attachments/20131112/d13b44aa/attachment.html>