From 54845a22b56b6eaeef67a2b29f71894f1b76dfd6 Mon Sep 17 00:00:00 2001 From: John Southworth Date: Wed, 17 Aug 2011 16:04:32 -0500 Subject: Bugfix 7442: Check if running interactively before doing binding options --- etc/bash_completion.d/vyatta-op | 20 +++++++++++++------- 1 file 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 -- cgit v1.2.3