[pmwiki-users] WikiSh - check string length
adam overton
a at plus1plus1plus.org
Sun Jun 8 12:22:16 CDT 2008
doh!
you're exactly right
i'm not following the syntax
and now it works bee-you-ti-fully
thanks again!!
adam
On 8 Jun 2008, at 5:52 AM, Peter & Melodye Bowers wrote:
> Sorry – I got caught on the same thing you did. You need to have
> the “test” command after “if”:
>
> {(set -s word = "blammo")}
> result: {(wikish if test ${#word} -gt 10; then; echo
> "string too big"; else; echo "string just right"; fi)}
>
> Yep, sure enough. Just typed it into my control panel and it works
> fine now.
>
> Looks like I need a clearer error message if someone puts an
> invalid MX after the if… I’ll put that on the development roadmap.
>
> Hope t hat helps!
>
> -Peter
>
> From: adam overton [mailto:a at plus1plus1plus.org]
> Sent: Sunday, June 08, 2008 11:46 AM
> To: pmwiki-users
> Cc: Peter & Melodye Bowers
> Subject: WikiSh - check string length
>
>
> and one more WikiSh question while we're at it:
>
> and again, i'm not understanding why this won't work - i want to
> check the length of a string, and if it's too long, i'd like to
> print something different out... this is what i had hoped would work:
>
> {(set -s word = "blammo")}
> result: {(wikish if ${#word} -gt 10; then; echo "string
> too big"; else; echo "string just right"; fi)}
>
> however, the result i get is
>
> result = {#word} -gt 10)
> string too big
>
>
> any ideas on how i can get the string length to be treated like a
> number and then successfully pushed thru the if statement?
>
> thanks
> adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20080608/37445abe/attachment.html
More information about the pmwiki-users
mailing list