diff options
author | Tom Grennan <tgrennan@vyatta.com> | 2007-10-03 11:09:00 -0700 |
---|---|---|
committer | Tom Grennan <tgrennan@vyatta.com> | 2007-10-03 11:09:00 -0700 |
commit | 105f2341577159ed25249fb3a6f4573ea6aa2ea8 (patch) | |
tree | cc63e73b773930e38b7da7d9baf99c02a2f69185 /etc | |
parent | dfd86634b5e470868fea1a370c7563e6060cd207 (diff) | |
download | vyatta-op-105f2341577159ed25249fb3a6f4573ea6aa2ea8.tar.gz vyatta-op-105f2341577159ed25249fb3a6f4573ea6aa2ea8.zip |
replace for loop in allowed search with shell var expansion
Diffstat (limited to 'etc')
-rw-r--r-- | etc/bash_completion.d/vyatta-op | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/etc/bash_completion.d/vyatta-op b/etc/bash_completion.d/vyatta-op index fe402ef..0175528 100644 --- a/etc/bash_completion.d/vyatta-op +++ b/etc/bash_completion.d/vyatta-op @@ -71,18 +71,18 @@ _vyatta_op_get_node_def_field () _vyatta_op_set_allowed_subdirs () { local dir=$1 - local n=${vyatta_op_templates}/${dir}/node.tag/node.def + local -a sdir_ndefs sdirs + local tag_ndef local restore_shopts=$( shopt -p extglob nullglob | tr \\n \; ) shopt -s extglob nullglob - unset _vyatta_op_allowed - for a in ${vyatta_op_templates}/${dir}/!(node.tag) ; do - [[ -d $a && -f $a/node.def ]] && \ - _vyatta_op_allowed+=( ${a##*/} ) - done + sdir_ndefs=( ${vyatta_op_templates}/${dir}/!(node.tag)/node.def ) + sdirs=( ${sdir_ndefs[@]%/*} ) + _vyatta_op_allowed=( ${sdirs[@]##*/} ) - if [ -f $n ] ; then - local acmd=$( _vyatta_op_get_node_def_field $n allowed ) + tag_ndef=${vyatta_op_templates}/${dir}/node.tag/node.def + if [ -f $tag_ndef ] ; then + local acmd=$( _vyatta_op_get_node_def_field $tag_ndef allowed ) _vyatta_op_allowed+=($( eval "$acmd" )) fi |