summaryrefslogtreecommitdiff
path: root/etc/bash_completion.d/vyatta-cfg
diff options
context:
space:
mode:
authorJohn Southworth <john.southworth@vyatta.com>2011-10-06 16:21:07 -0500
committerJohn Southworth <john.southworth@vyatta.com>2011-10-06 16:21:07 -0500
commit0fdc2604d8fb0fcc21a9cba59e1993dabe9d671e (patch)
tree32e21fddabd1f24e3ea8b16fe2d563cd03480048 /etc/bash_completion.d/vyatta-cfg
parenta064cdb85a9c870dbf276d24b218560532cb597a (diff)
downloadvyatta-cfg-0fdc2604d8fb0fcc21a9cba59e1993dabe9d671e.tar.gz
vyatta-cfg-0fdc2604d8fb0fcc21a9cba59e1993dabe9d671e.zip
Bugfix 6747: use bash conditional expressions instead of posix test expressions when doing comparisons. The conditional expressions don't do as much expansion as the test expression does, and are the modern variant
Diffstat (limited to 'etc/bash_completion.d/vyatta-cfg')
-rwxr-xr-xetc/bash_completion.d/vyatta-cfg14
1 files changed, 7 insertions, 7 deletions
diff --git a/etc/bash_completion.d/vyatta-cfg b/etc/bash_completion.d/vyatta-cfg
index 12e7e74..90e7f9a 100755
--- a/etc/bash_completion.d/vyatta-cfg
+++ b/etc/bash_completion.d/vyatta-cfg
@@ -724,7 +724,7 @@ vyatta_config_invalid_comp ()
local path=''
local opath=''
local failed=false
- local validate="cli-shell-api validateTmplPath -- $editlvl ${expanded_api_args[@]:1}"
+ local validate="cli-shell-api validateTmplPath -- $editlvl '${expanded_api_args[@]:1}'"
eval $validate
local validateret=$?
if [[ $validateret -eq 0 ]]; then
@@ -790,7 +790,7 @@ vyatta_config_complete ()
local current_word=$3
local current_prefix=$2
- if [ "$COMP_LINE" == "$VYATTA_COMP_LINE" ]; then
+ if [[ "$COMP_LINE" == "$VYATTA_COMP_LINE" ]]; then
VYATTA_COMP_LINE=$VYATTA_COMP_LINE_EMPTY
vyatta_do_help=true
else
@@ -843,7 +843,7 @@ vyatta_config_complete ()
local last_comp="${COMP_WORDS[COMP_CWORD]}"
# handle "exit"
- if [ "$command" == "exit" ]; then
+ if [[ "$command" == "exit" ]]; then
if (( COMP_CWORD > 1 )); then
echo -en "\nPossible completions:\n"
echo -en " <Enter>\tExecute the current command"
@@ -863,7 +863,7 @@ vyatta_config_complete ()
local -a api_args=("${COMP_WORDS[@]:0:$[$COMP_CWORD+1]}")
# handle "copy" and "rename"
- if [ "$command" == "copy" -o "$command" == "rename" ]; then
+ if [[ "$command" == "copy" || "$command" == "rename" ]]; then
# Syntax of copy and rename commands are:
#
# copy/rename <param1> <sub-param1> to <param2> <sub-param2>
@@ -911,7 +911,7 @@ vyatta_config_complete ()
if [[ -n "$current_word" ]] &&
[[ -n "$last_comp" ]] &&
[[ ! "$current_word" =~ "$last_comp" ]]; then
- if [ -n "$current_prefix" ];then
+ if [[ -n "$current_prefix" ]];then
api_args=( "${api_args[@]:0:$[$COMP_CWORD]}" "$current_prefix" )
else
api_args=( "${api_args[@]:0:$COMP_CWORD}" "" )
@@ -946,10 +946,10 @@ vyatta_config_complete ()
done
vyatta_completions=()
for ((i = 0; i < ${#_cli_shell_api_comp_values[@]}; i++)); do
- if [ -z "$current_prefix" ] \
+ if [[ -z "$current_prefix" ]] \
&& [[ "${_cli_shell_api_comp_values[i]}" = \<*\> ]]; then
vyatta_completions+=("")
- elif [ -z "$last_comp" ] \
+ elif [[ -z "$last_comp" ]] \
|| [[ "${_cli_shell_api_comp_values[i]}" = "$current_prefix"* ]]; then
vyatta_completions+=("${_cli_shell_api_comp_values[i]}")
fi