Executing simple commands is pretty straight forward. But what is the best way to write, if the command is a script block instead of a one-liner, e.g.:
exec {
command => 'for i in vars
do
echo $i
more-statements
done';
}
A couple of ways that I can think of are:
- Write the script block with proper escaping to get it to work (not a very tidy option)
- Write the script block in file.sh and execute it in command
Are there any other options?