[pmwiki-users] WikiSh noob - -gt & -lt

Peter & Melodye Bowers pbowers at pobox.com
Thu Jun 5 16:30:49 CDT 2008


The various control flow elements (conditionals, looping, etc.) within
WikiSh are implemented as part of the {(wikish .)} MX rather than being
individual MXes themselves.  Thus {(if test .)} is undefined as far as
WikiSh is concerned.  It needs to be {(wikish if test .)}

 

While developing your solution you will probably find the control panel to
be *very* helpful.  It allows you to type this:

 

if test 3 -gt 4

then

   echo YES

else

   echo NO

fi

 

And it will convert it to {(wikish if test 3 -gt 4; then; echo YES; else;
echo NO; fi;)} and show you the results.

 

If you'd like to explore other options I'm pretty sure you could fairly
easily (?) expand (:if .:) functionality to include a > or < comparison
using the $Conditions array.  I've never done it, but looking at the setting
for "equals" in pmwiki.php I think you could expand it like this:

 

$Conditions['gt'] = 'CompareArgs($condparm) > 0';

$Conditions['ge'] = 'CompareArgs($condparm) >= 0';

$Conditions['lt'] = 'CompareArgs($condparm) < 0';

$Conditions['le'] = 'CompareArgs($condparm) <= 0';

 

Or something like that.  Others who have worked with this $Condition
variable can give a more exact answer.

 

-Peter

 

  _____  

From: pmwiki-users-bounces at pmichaud.com
[mailto:pmwiki-users-bounces at pmichaud.com] On Behalf Of adam overton
Sent: Monday, June 02, 2008 1:34 PM
To: pmwiki-users
Subject: [pmwiki-users] WikiSh noob - -gt & -lt

 

 

 

hi

i'm trying out WikiSh for the first time

and am wondering why both

 

 

{(if test 3 -gt 4; then; echo YES; else; echo NO; fi)}

 

&

 

{(set Num1 = 3)}

{(set Num2 = 4)}

{(if test ${Num1} -gt ${Num2}; then; echo "YES"; else; echo "NO"; fi)}

 

 

spit out "3" instead of NO?

 

btw, is WikiSh my only option if i just want to do a > or < operation?

thanks,

adam

 

. . .

 

a at plus1plus1plus.org

661 373 8679

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20080605/a828584e/attachment.html 


More information about the pmwiki-users mailing list