summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Southworth <john.southworth@vyatta.com>2011-08-17 16:04:32 -0500
committerJohn Southworth <john.southworth@vyatta.com>2011-08-17 16:20:14 -0500
commit54845a22b56b6eaeef67a2b29f71894f1b76dfd6 (patch)
tree1e52012d6c33dc2c3b9dcc5c72c267078263a86c
parentfe38fc5bf3bded486133e5ee1a4c21d403d85c42 (diff)
downloadvyatta-op-54845a22b56b6eaeef67a2b29f71894f1b76dfd6.tar.gz
vyatta-op-54845a22b56b6eaeef67a2b29f71894f1b76dfd6.zip
Bugfix 7442: Check if running interactively before doing binding options
-rw-r--r--etc/bash_completion.d/vyatta-op20
1 files changed, 13 insertions, 7 deletions
diff --git a/etc/bash_completion.d/vyatta-op b/etc/bash_completion.d/vyatta-op
index 0573a67..6be6b81 100644
--- a/etc/bash_completion.d/vyatta-op
+++ b/etc/bash_completion.d/vyatta-op
@@ -40,14 +40,16 @@ _vyatta_op_do_key_bindings ()
# only do bindings if vbash
return
fi
-
- bind '"?": possible-completions' 2> /dev/null
- bind 'set show-all-if-ambiguous on' 2> /dev/null
-
nullglob_save=$(shopt -p nullglob)
shopt -u nullglob
- bind_cmds=$(grep '^bind .* # vyatta key binding$' $HOME/.bashrc)
- eval $bind_cmds 2> /dev/null
+ case "$-" in
+ *i*)
+ bind '"?": possible-completions'
+ bind 'set show-all-if-ambiguous on'
+ bind_cmds=$(grep '^bind .* # vyatta key binding$' $HOME/.bashrc)
+ eval $bind_cmds
+ ;;
+ esac
eval $nullglob_save
}
@@ -59,7 +61,11 @@ test -f /etc/default/vyatta && \
test ! -d "$vyatta_op_templates" && \
return 0
-declare -r _vyatta_op_last_comp_init='>>>>>>LASTCOMP<<<<<<'
+case "$-" in
+ *i*)
+ declare -r _vyatta_op_last_comp_init='>>>>>>LASTCOMP<<<<<<'
+ ;;
+esac
declare _vyatta_op_last_comp=${_vyatta_op_last_comp_init}
declare _vyatta_op_node_path
declare -a _vyatta_op_noncompletions _vyatta_op_completions