sh script ?

Rick Miller vmiller at hostileadmin.com
Thu Jan 24 18:29:51 UTC 2013


On Thu, Jan 24, 2013 at 1:07 PM, Fbsd8 <fbsd8 at a1poweruser.com> wrote:
> I get this message [: 10.0.10.21: bad number on this code
>
>    [ "${saved_ip}" -eq "${used_ip}" ] && echo "good match"
>
> Both variables have valid ip addresses in them.
> Why does it think the variable content is a number and not text?
> What am I doing wrong?

The -eq operator is used to compare integers.  When comparing strings,
use the == operator.


-- 
Take care
Rick Miller


More information about the freebsd-questions mailing list