Look at your inputs. What happens if curl returns something with no data or with random data in it. Especially if it has punctuation in it.
On Sat, Feb 18, 2012 at 8:13 AM, Rich Shepard <[email protected]>wrote: > This morning my inbox contained a message from root generated when the > hourly cron job ran at 4:00am: > > /home/rshepard/shell-scripts/ngetip.sh: line 4: [: !=: unary operator > expected > > Here are the first few lines of the script: > > #!/bin/bash > OLDIP=$(cat /home/rshepard/CURRENTIP) > NEWIP=$(curl -s http://automation.whatismyip.com/n09230945.asp) > if [ $NEWIP != $OLDIP ]; then > echo $OLDIP > echo $NEWIP > > This script has run for the past week plus without generating any errors. > Looking in my ORA bash shell book the syntax for an if statement (using > brackets to deliniate the if condition) seems correct. What might have > caused this message to be generated? > > Rich > > _______________________________________________ > PLUG mailing list > [email protected] > http://lists.pdxlinux.org/mailman/listinfo/plug > > -- John Sechrest @sechrest http://www.oomaat.com _______________________________________________ PLUG mailing list [email protected] http://lists.pdxlinux.org/mailman/listinfo/plug
