Date: Thu, 16 May 2013 10:45:25 -0500 From: Dan Nelson <dnelson@allantgroup.com> To: Tim Daneliuk <tundra@tundraware.com> Cc: freebsd-questions@freebsd.org Subject: Re: check variable content size in sh script Message-ID: <20130516154525.GA57497@dan.emsphone.com> In-Reply-To: <5194FB0A.9090400@tundraware.com> References: <5194F65F.6080503@a1poweruser.com> <5194FB0A.9090400@tundraware.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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} -- Dan Nelson dnelson@allantgroup.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130516154525.GA57497>