Represents a block of tasks.
The block sets the current working directory to the base dir (the default base dir is the same directory as the script resides in).
@ Installing nginx
- yum_install nginx
With conditions
@ Installing nginx
when not which nginx
- yum_install nginx
With multiple conditions (OR)
@ Installing nginx
when not which nginx
or not test -d /etc/nginx
- yum_install nginx
With multiple conditions (AND)
@ Probably on linux system
when test -d /sys
and test -d /dev
and test -d /proc
- foo
- bar
You can write also 'or when' and 'and when'.
If there are multiple 'when' in the beginning, it means AND.
Loops:
Sometimes you need to use a loop. The loop should be executed only if the condition of the block passes. In this case, you have to use "-&&" (i.e. "- &&") which will do the job.
output_to_var DBS cat databases_to_install.txt
@ Installing databases
when is not empty_var DBS
-&& for db in $DBS; do yum_install $db; done