X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5e7ffafe86f9a1468bb19ec9c40a68f8eebf6d2e..c1fa53426d4f4db5c1fe697d915d30247fd5d09a:/tools/tesh2/examples/var.tesh?ds=sidebyside diff --git a/tools/tesh2/examples/var.tesh b/tools/tesh2/examples/var.tesh index 631d60887f..ecc263985c 100644 --- a/tools/tesh2/examples/var.tesh +++ b/tools/tesh2/examples/var.tesh @@ -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 ( 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 ( 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}