From owner-freebsd-questions@FreeBSD.ORG Thu Jan 24 18:56:56 2013 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2A5F4AEB for ; Thu, 24 Jan 2013 18:56:56 +0000 (UTC) (envelope-from bonomi@mail.r-bonomi.com) Received: from mail.r-bonomi.com (mx-out.r-bonomi.com [204.87.227.120]) by mx1.freebsd.org (Postfix) with ESMTP id D8052E8D for ; Thu, 24 Jan 2013 18:56:55 +0000 (UTC) Received: (from bonomi@localhost) by mail.r-bonomi.com (8.14.4/rdb1) id r0OJ0Zck076069; Thu, 24 Jan 2013 13:00:35 -0600 (CST) Date: Thu, 24 Jan 2013 13:00:35 -0600 (CST) From: Robert Bonomi Message-Id: <201301241900.r0OJ0Zck076069@mail.r-bonomi.com> To: fbsd8@a1poweruser.com, questions@freebsd.org Subject: Re: sh script ? In-Reply-To: <5101786C.3070209@a1poweruser.com> X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Jan 2013 18:56:56 -0000 > From owner-freebsd-questions@freebsd.org Thu Jan 24 12:11:42 2013 > Date: Thu, 24 Jan 2013 13:07:40 -0500 > From: Fbsd8 > To: FreeBSD questions > Subject: sh script ? > > 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? Why?? BECAUSE YOU TOld IT TO. RTFM applies. Specifically 'man test'. You need to either read some books on BASIC shell programming or take a course or two on that subject. This may sound harsh, but you will save yourself a -lot- of future aggravation with some structured education. It will also assist you in getting maximum value from the manpages. Programming _is_ an art-form. You have to train yourself to think the way the machine does. When it complains about 'something', it is *AlMOST*ALWAYS* correct, and something you -think- is correct is actually wrong. the hard thing to learn in troubleshooting problems is to set aside what you "know" is correct, and look for anything that could possibly cause the complaint. Remember, you're looking for something "impossible".