From b0dca6bb7dfa2a651f99e38541cbc25a3dec19b7 Mon Sep 17 00:00:00 2001 From: John Southworth Date: Wed, 17 Aug 2011 16:06:14 -0500 Subject: Bugfix 7442: Check if running interactively before doing binding options --- etc/bash_completion.d/vyatta-cfg | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'etc/bash_completion.d/vyatta-cfg') diff --git a/etc/bash_completion.d/vyatta-cfg b/etc/bash_completion.d/vyatta-cfg index cacf365..9e9d652 100755 --- a/etc/bash_completion.d/vyatta-cfg +++ b/etc/bash_completion.d/vyatta-cfg @@ -638,14 +638,18 @@ reset_edit_level export VYATTA_COMP_LINE_EMPTY=VYATTA_COMP_LINE_EMPTY export VYATTA_COMP_LINE=$VYATTA_COMP_LINE_EMPTY -# readline bindings -bind 'set show-all-if-ambiguous on' -if ! bind -p |grep -q '\\C-x\\C-t'; then - bind '"\C-x\C-t": kill-region' -fi -if ! bind -p |grep -q '\\C-x\\C-o'; then - bind '"\C-x\C-o": copy-region-as-kill' -fi +# readline bindings +case "$-" in + *i*) + bind 'set show-all-if-ambiguous on' + if ! bind -p |grep -q '\\C-x\\C-t'; then + bind '"\C-x\C-t": kill-region' + fi + if ! bind -p |grep -q '\\C-x\\C-o'; then + bind '"\C-x\C-o": copy-region-as-kill' + fi + ;; +esac # note: now that we're using bash's new "empty completion" (-E), it becomes # necessary to capture the "default completion" (-D) as well in order to -- cgit v1.2.3