5 # use a safer version of echo (no option)
16 # $1: node sequence number (ex: ec_node4)
17 ec_parse_get_first_child()
19 local first_child=${1}_first_child
20 echo $(eval 'echo ${'$first_child'}')
23 # $1: node sequence number (ex: ec_node4)
27 echo $(eval 'echo ${'$next'}')
30 # $1: node sequence number (ex: ec_node4)
33 local seq=${1#ec_node}
35 local next=ec_node${seq}
36 if [ "$(ec_parse_get_id $next)" != "" ]; then
41 # $1: node sequence number (ex: ec_node4)
45 echo $(eval 'echo ${'$id'}')
48 # $1: node sequence number (ex: ec_node4)
49 ec_parse_get_strvec_len()
51 local strvec_len=${1}_strvec_len
52 echo $(eval 'echo ${'$strvec_len'}')
55 # $1: node sequence number (ex: ec_node4)
62 local str=${1}_str${2}
63 echo $(eval 'echo ${'$str'}')
66 # $1: node sequence number (ex: ec_node4)
67 # $2: node id (string)
74 while [ "$node_seq" != "" ]; do
75 local id=$(ec_parse_get_id $node_seq)
76 if [ "$id" = "$2" ]; then
80 node_seq=$(ec_parse_iter_next $node_seq)
92 help: Say hello to someone
98 help: Name of the person to greet
106 help: Say good bye to someone
114 help: Name of the person to greet
124 $path/build/parse-yaml -i $yaml -o $output || match=0
125 if [ "$match" = "1" ]; then
128 name=$(ec_parse_get_str $(ec_parse_find_first ec_node1 name) 0)
129 hello=$(ec_parse_get_str $(ec_parse_find_first ec_node1 hello) 0)
131 if [ "$hello" != "" ]; then
132 echo "$name says hello to you!"
134 echo "$name says good bye to you!"