From owner-freebsd-questions@FreeBSD.ORG Thu May 16 16:14:21 2013 Return-Path: Delivered-To: freebsd-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 B9C1E10A for ; Thu, 16 May 2013 16:14:21 +0000 (UTC) (envelope-from tundra@tundraware.com) Received: from ozzie.tundraware.com (ozzie.tundraware.com [75.145.138.73]) by mx1.freebsd.org (Postfix) with ESMTP id 86FD6115 for ; Thu, 16 May 2013 16:14:21 +0000 (UTC) Received: from [192.168.0.2] (viper.tundraware.com [192.168.0.2]) (authenticated bits=0) by ozzie.tundraware.com (8.14.7/8.14.7) with ESMTP id r4GGE11k001962 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO) for ; Thu, 16 May 2013 11:14:01 -0500 (CDT) (envelope-from tundra@tundraware.com) Message-ID: <519505C9.40109@tundraware.com> Date: Thu, 16 May 2013 11:14:01 -0500 From: Tim Daneliuk User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: FreeBSD Mailing List Subject: Re: check variable content size in sh script References: <5194F65F.6080503@a1poweruser.com> <5194FB0A.9090400@tundraware.com> <20130516154525.GA57497@dan.emsphone.com> In-Reply-To: <20130516154525.GA57497@dan.emsphone.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (ozzie.tundraware.com [192.168.0.1]); Thu, 16 May 2013 11:14:01 -0500 (CDT) X-TundraWare-MailScanner-Information: Please contact the ISP for more information X-TundraWare-MailScanner-ID: r4GGE11k001962 X-TundraWare-MailScanner: Found to be clean X-TundraWare-MailScanner-From: tundra@tundraware.com X-Spam-Status: No 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, 16 May 2013 16:14:21 -0000 On 05/16/2013 10:45 AM, Dan Nelson wrote: > In the last episode (May 16), Tim Daneliuk said: >> On 05/16/2013 10:08 AM, Joe wrote: >>> Hello >>> >>> Have script that has max size on content in a variable. >>> How to code size less than 51 characters? >>> >> >> FOO="Some string you want to check length of" >> FOOLEN=`echo $FOO | wc | awk '{print $3}'` >> >> You can then use $FOOLEN in a conditional. > > Much better way: > > FOO="Some string you want to check length of" > FOOLEN=${#FOO} > D'Oh, you're right ... what was I thinking ... -- ---------------------------------------------------------------------------- Tim Daneliuk tundra@tundraware.com PGP Key: http://www.tundraware.com/PGP/