From 4c6171a1e13401d5339f9bac7c9fe51801f86746 Mon Sep 17 00:00:00 2001 From: An-Cheng Huang Date: Wed, 14 Jul 2010 17:02:47 -0700 Subject: separate val_help parsing from eval --- etc/bash_completion.d/20vyatta-cfg | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'etc/bash_completion.d/20vyatta-cfg') diff --git a/etc/bash_completion.d/20vyatta-cfg b/etc/bash_completion.d/20vyatta-cfg index f0f621b..06c1c08 100755 --- a/etc/bash_completion.d/20vyatta-cfg +++ b/etc/bash_completion.d/20vyatta-cfg @@ -686,16 +686,17 @@ vyatta_parse_tmpl () fi fi vyatta_cfg_comp_help=$(vyatta_parse_tmpl_comp_fields $1 "comp_help") - eval `grep '^val_help:' $1 | sed 's/^val_help:[ ]*//; + local vhstr=$(grep '^val_help:' $1 | sed 's/^val_help:[ ]*//; s/[ ]*;[ ]*/;/' \ - | while read line; do - if [[ "$line" == *";"* ]]; then - echo "vyatta_cfg_val_type+=( \"${line%%;*}\" )" - echo "vyatta_cfg_val_help+=( \"${line##*;}\" )" - else - echo "vyatta_cfg_val_help+=( \"$line\" )" - fi - done` + | while read line; do + if [[ "$line" == *";"* ]]; then + echo "vyatta_cfg_val_type+=( \"${line%%;*}\" )" + echo "vyatta_cfg_val_help+=( \"${line##*;}\" )" + else + echo "vyatta_cfg_val_help+=( \"$line\" )" + fi + done) + eval "$vhstr" if (( ${#vyatta_cfg_allowed[@]} == 0 )); then astr=$(eval "$acmd") -- cgit v1.2.3