Re: how to check the length of a variable in ksh?

From: Bill Verzal (Bill_Verzal@BCBSIL.COM)
Date: Thu Nov 21 2002 - 12:10:17 EST


echo "$variable"|wc -c
--------------------------------------------------------------------------------------------------------

Bill Verzal
Technical Consultant
Forbes Technical Consulting
(312) 653-3684
bill_verzal@bcbsil.com
billverzal@imcingular.com (Pager)
888-428-4025 (Pager)
MailStop: 27.202B

                    "Clifton, Pablo"
                    <Pablo.Clifton@B To: aix-l@Princeton.EDU
                    CBSFL.COM> cc:
                    Sent by: "IBM Subject: how to check the length of a variable in ksh?
                    AIX Discussion
                    List"
                    <aix-l@Princeton
                    .EDU>

                    11/21/2002 11:01
                    AM
                    Please respond
                    to "IBM AIX
                    Discussion List"

Hi-

Anyone know how I can check in a korn shell script:

        if [[ length of variable $i is > 5 characters ]]
        then
                do something
        fi

thanks,
-pablo

--
Pablo Clifton
UNIX Tech Services
Blue Cross Blue Shield of Florida, Inc., and its subsidiary and
affiliate companies are not responsible for errors or omissions in this
e-mail message. Any personal comments made in this e-mail do not reflect
the views of Blue Cross Blue Shield of Florida, Inc.
**********
The information contained in this communication is confidential, private, proprietary, or otherwise privileged and is intended only for the use of the addressee.  Unauthorized use, disclosure, distribution or copying is strictly prohibited and may be unlawful.  If you have received this communication in error, please notify the sender immediately at (312)653-6000 in Illinois; (972)766-6900 in Texas; or (800)835-8699 in New Mexico.
**********


This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:22 EDT