Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
The correction of a comment
[simgrid.git] / tools / tesh2 / examples / var.tesh
index 631d608..5269643 100644 (file)
@@ -23,10 +23,10 @@ D Usage of tesh variables
 ! expect return $ESYNTAX
 < ! include-file=
 < ! include $include-file
-$ ./tesh --log='log.thresh:info tesh.fmt:%m%n'
+$ ./tesh --log="log.thresh:info tesh.fmt:%m%n"
 > Test unit from stdin
 > [stdin:1] Undefined variable `(include-file)'
-> Test unit `(stdin)' : NOK (syntax error)
+> Test unit `stdin': NOK (<stdin:1> syntax error)
 
 
 # A single sample of the usage of the tesh variables
@@ -100,32 +100,67 @@ p On this platform ENOENT is: $ENOENT
 ! expect return $ESYNTAX
 < ! ENOENT=300
 < $ echo $ENOENT
-$ ./tesh --log='log.thresh:info tesh.fmt:%m%n'
+$ ./tesh --log="log.thresh:info tesh.fmt:%m%n"
 > Test unit from stdin
 > [stdin:1] A system variable named `(ENOENT)' already exists
-> Test unit `(stdin)' : NOK (syntax error)
+> Test unit `stdin': NOK (<stdin:1> syntax error)
 
+# Substitution usage
 
+! new=1
 
+p new is `$new ' or `${new}'
 
+p the len of new is : ${#new}
 
+! unset new
 
+p new is empty <$new> and is len is <${#new}>
 
+# display 66 and assign 66 to the value 66 of the variable new
 
+p ${new:=66}
 
+p new is `$new ' or `${new}'
 
+p the len of new is : ${#new}
 
+# display 66 and do not assign the value 69 to the variable
 
+p ${new:=69}
 
+p new is `$new ' or `${new}'
 
+p the len of new is : ${#new}
 
+! unset new
 
+# display 79 and do not assigne the value 79 to the variable
+# new is empty
+p ${new:-79}
 
+p new is `$new ' or `${new}'
 
+p the len of new is : ${#new}
 
+# display nothing and do not assigne the value 89 to the variable
+# new is empty
+p is empty ${new:+89}
 
+p new is `$new ' or `${new}'
 
+p the len of new is : ${#new}
 
+! set new=999
 
+# display 99 and do not assigne the value 99 to the variable (do not dispaly the value of new)
+# new is empty
+p is empty ${new:+99}
 
+p new is `$new ' or `${new}'
 
+p the len of new is : ${#new}
+
+! unset new
+
+# p ${new:?new is empty}