mirror of
https://github.com/A2osX/A2osX.git
synced 2024-06-07 17:29:34 +00:00
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:
parent
3b08cbb8d9
commit
ba003e8f20
|
@ -52,6 +52,35 @@ IFTTT Tweet using HTTPGET
|
||||||
where [ exp ] and [ condition ] allow to detail operators....
|
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:
|
## Internal Shell commands:
|
||||||
|
|
||||||
| Name | Status | Comment |
|
| Name | Status | Comment |
|
||||||
|
@ -73,7 +102,7 @@ where [ exp ] and [ condition ] allow to detail operators....
|
||||||
| EXIT | Working | exit function, script or shell |
|
| EXIT | Working | exit function, script or shell |
|
||||||
| FI | Working | Terminator for IF block |
|
| FI | Working | Terminator for IF block |
|
||||||
| FUNC | In Progress | FUNC fonction_name <br> \<body\> <br> END |
|
| FUNC | In Progress | FUNC fonction_name <br> \<body\> <br> END |
|
||||||
| IF | Working | [ \<condition\> ] |
|
| IF | Working | [ \<condition\> ] <br> ![ \<condition\> ]|
|
||||||
| LOOP | Working | Terminator for WHILE block |
|
| LOOP | Working | Terminator for WHILE block |
|
||||||
| MD | Working | MD path or relative path <br> Create a directory |
|
| MD | Working | MD path or relative path <br> Create a directory |
|
||||||
| NOHUP | Working | Start a process with PPID=PS0 (Daemon) |
|
| NOHUP | Working | Start a process with PPID=PS0 (Daemon) |
|
||||||
|
|
|
@ -59,9 +59,12 @@ ELSE
|
||||||
ECHO "WHILE LOOP Test 2 Failed" >> ${Log}
|
ECHO "WHILE LOOP Test 2 Failed" >> ${Log}
|
||||||
FI
|
FI
|
||||||
FI
|
FI
|
||||||
|
#
|
||||||
|
# This next tests uses the NOT variant of the condition block
|
||||||
|
#
|
||||||
set counter = 0
|
set counter = 0
|
||||||
set total = 2000
|
set total = 2000
|
||||||
while [ $total -ne 0 ]
|
while ![ $total -eq 0 ]
|
||||||
set total = $total - 100
|
set total = $total - 100
|
||||||
set counter = $counter + 1
|
set counter = $counter + 1
|
||||||
ECHO -N "\e[18;10HTest 3 - Counter : ${count} Total : ${total} "
|
ECHO -N "\e[18;10HTest 3 - Counter : ${count} Total : ${total} "
|
||||||
|
|
Loading…
Reference in New Issue
Block a user