mo/demo/associative-arrays

20 lines
293 B
Plaintext
Raw Permalink Normal View History

#!/usr/bin/env bash
2015-05-05 16:04:41 +00:00
cd "$(dirname "$0")" # Go to the script's directory
declare -A DATA
2023-04-10 16:39:47 +00:00
export DATA=([one]=111 [two]=222)
. ../mo
cat <<EOF | mo
Accessing data directly:
DATA: {{DATA}}
One: {{DATA.one}}
Two: {{DATA.two}}
Things in DATA:
{{#DATA}}
Item: {{.}}
{{/DATA}}
EOF