Updated WHILETEST and Shell Dev doc to use the newly discovered ![] (NOT Exp) logic. Put examples of usage in doc.

This commit is contained in:
Patrick Kloepfer 2019-04-12 10:53:00 -04:00
parent 3b08cbb8d9
commit ba003e8f20
2 changed files with 36 additions and 4 deletions

View File

@ -52,6 +52,35 @@ IFTTT Tweet using HTTPGET
where [ exp ] and [ condition ] allow to detail operators....
anywhere you can have [ exp ] you can have ![ exp ] which means NOT exp.
while ![ $total -eq 0 ]
loop
is the same thing as
while [ $total -ne 0 ]
loop
Just like
IF [ A -GT 5 ]
DO X
ELSE
DO Y
FI
is the same as
IF ![ A -LE 5 ]
DO Y
ELSE
DO X
FI
Notice that the DO X and DO Y logic is swapped between the two cases.
## Internal Shell commands:
| Name | Status | Comment |
@ -73,7 +102,7 @@ where [ exp ] and [ condition ] allow to detail operators....
| EXIT | Working | exit function, script or shell |
| FI | Working | Terminator for IF block |
| FUNC | In Progress | FUNC fonction_name <br> \<body\> <br> END |
| IF | Working | [ \<condition\> ] |
| IF | Working | [ \<condition\> ] <br> ![ \<condition\> ]|
| LOOP | Working | Terminator for WHILE block |
| MD | Working | MD path or relative path <br> Create a directory |
| NOHUP | Working | Start a process with PPID=PS0 (Daemon) |

View File

@ -59,9 +59,12 @@ ELSE
ECHO "WHILE LOOP Test 2 Failed" >> ${Log}
FI
FI
#
# This next tests uses the NOT variant of the condition block
#
set counter = 0
set total = 2000
while [ $total -ne 0 ]
while ![ $total -eq 0 ]
set total = $total - 100
set counter = $counter + 1
ECHO -N "\e[18;10HTest 3 - Counter : ${count} Total : ${total} "