Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 May 2013 09:29:25 -0600
From:      markham breitbach <markham_breitbach@ssimicro.com>
To:        Joe <fbsd8@a1poweruser.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: check variable content size in sh script
Message-ID:  <5194FB55.3080600@ssimicro.com>
In-Reply-To: <5194F65F.6080503@a1poweruser.com>
References:  <5194F65F.6080503@a1poweruser.com>

next in thread | previous in thread | raw e-mail | index | archive | help
something like this:

#!/bin/sh
if [ $# -lt 1 ] ; then
echo "put a nickel in the slot, pal!"
exit 1;
fi
NUMCHARS=`echo $1 | wc -m`
if [ $NUMCHARS -lt 51 ] ; then
echo "You input "$NUMCHARS" characters."
exit 0
else
echo "whoa sailor I can't take all that!"
exit 1
fi


On 13-05-16 9:08 AM, Joe wrote:
> Hello
>
> Have script that has max size on content in a variable.
> How to code size less than 51 characters?
>
> Thanks
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5194FB55.3080600>