Skip to content

Instantly share code, notes, and snippets.

@ahonor
Last active March 1, 2018 00:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahonor/d5aeb8aa20767e0fcf9fd1595e0f26e3 to your computer and use it in GitHub Desktop.
Save ahonor/d5aeb8aa20767e0fcf9fd1595e0f26e3 to your computer and use it in GitHub Desktop.
[
"Tue Feb 27 02:39:35",
"Sun Feb 25 04:06:58",
"Mon Feb 26 01:03:08"
]
- description: ''
executionEnabled: true
id: 544bfdc9-da30-4822-a01e-2ca6f4285472
loglevel: INFO
name: multi-options with spaces
nodeFilterEditable: false
options:
- delimiter: ','
multivalued: true
name: dates
required: true
valuesUrl: file:/tmp/dates.json
scheduleEnabled: true
sequence:
commands:
- args: ${option.dates.delimiter} ${option.dates}
script: |-
#!/bin/bash
#1st arg is the delimiter string
declare -r delimiter=$1
#everything else is a space containing date string.
declare -ra datepatterns=( ${@:2} )
declare -i count=0
IFS=$delimiter read -ra dates <<< "${datepatterns[@]}"
for d in "${dates[@]}"
do
printf "date %d: %s\n" "$count" "$d"
((count++))
done
keepgoing: false
strategy: node-first
uuid: 544bfdc9-da30-4822-a01e-2ca6f4285472
- description: ''
executionEnabled: true
id: 544bfdc9-da30-4822-a01e-2ca6f4285472
loglevel: INFO
name: multi-options with spaces
nodeFilterEditable: false
options:
- delimiter: ','
multivalued: true
name: dates
required: true
valuesUrl: file:/tmp/dates.json
scheduleEnabled: true
sequence:
commands:
- script: |-
echo "DEBUG: dates: @option.dates@"
IFS=, read -ra dates <<< "@option.dates@"
for d in "${dates[@]}"
do
printf "date: %s\n" "$d"
done
keepgoing: false
strategy: node-first
uuid: 544bfdc9-da30-4822-a01e-2ca6f4285472
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment