diff options
author | An-Cheng Huang <ancheng@vyatta.com> | 2010-07-14 17:02:47 -0700 |
---|---|---|
committer | An-Cheng Huang <ancheng@vyatta.com> | 2010-07-14 17:02:47 -0700 |
commit | 4c6171a1e13401d5339f9bac7c9fe51801f86746 (patch) | |
tree | c1b2814944a06a209495c36959625dcd396f1e59 /etc | |
parent | c42e73f69e7e7605f38bdd59968e4c0ee80ff5b4 (diff) | |
download | vyatta-cfg-4c6171a1e13401d5339f9bac7c9fe51801f86746.tar.gz vyatta-cfg-4c6171a1e13401d5339f9bac7c9fe51801f86746.zip |
separate val_help parsing from eval
Diffstat (limited to 'etc')
-rwxr-xr-x | etc/bash_completion.d/20vyatta-cfg | 19 |
1 files changed, 10 insertions, 9 deletions
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") |