summaryrefslogtreecommitdiff
path: root/completions
diff options
context:
space:
mode:
authorVille Skyttä <ville.skytta@iki.fi>2011-11-09 22:24:39 +0200
committerVille Skyttä <ville.skytta@iki.fi>2011-11-09 22:46:21 +0200
commit1d48f79b9c6a9b9e9044741d300ded461d765135 (patch)
treeeddb695374079fa285914a54a428e1b06a61cb2a /completions
parentd54db3507dc79624ea5db1a031fac677d4c0dabe (diff)
downloadbash-completion-1d48f79b9c6a9b9e9044741d300ded461d765135.tar.gz
Cleanups: use usual globs instead of substring matches or substitutions.
Diffstat (limited to 'completions')
-rw-r--r--completions/info2
-rw-r--r--completions/mutt5
-rw-r--r--completions/ssh6
3 files changed, 6 insertions, 7 deletions
diff --git a/completions/info b/completions/info
index aa16be69..71865809 100644
--- a/completions/info
+++ b/completions/info
@@ -43,7 +43,7 @@ _info()
local i infopath=/usr/share/info
- if [ "${INFOPATH: -1:1}" == ':' ]; then
+ if [[ $INFOPATH == *: ]]; then
infopath=${INFOPATH}${infopath}
elif [ ${INFOPATH:+set} ]; then
infopath=$INFOPATH
diff --git a/completions/mutt b/completions/mutt
index 70699a15..f1fd6ff7 100644
--- a/completions/mutt
+++ b/completions/mutt
@@ -22,7 +22,7 @@ _muttrc()
# Search COMP_WORDS for '-F muttrc' or '-Fmuttrc' argument
set -- "${words[@]}"
while [ $# -gt 0 ]; do
- if [ "${1:0:2}" = -F ]; then
+ if [[ $1 == -F* ]]; then
if [ ${#1} -gt 2 ]; then
muttrc="$(dequote "${1:2}")"
else
@@ -60,8 +60,7 @@ _muttconffiles()
newconffiles=( $(sed -n 's|^source[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' $(eval echo $1) ) )
for file in "${newconffiles[@]}"; do
__expand_tilde_by_ref file
- [[ ! -f "$file" || "${sofar/ ${file} / }" != "$sofar" ]] &&
- continue
+ [[ ! -f "$file" || $sofar == *\ $file\ * ]] && continue
sofar+=" $file"
sofar=" $(eval _muttconffiles \"$sofar\" $file) "
done
diff --git a/completions/ssh b/completions/ssh
index e30b9153..e62b13fd 100644
--- a/completions/ssh
+++ b/completions/ssh
@@ -158,7 +158,7 @@ _ssh()
# Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument
set -- "${words[@]}"
while [ $# -gt 0 ]; do
- if [ "${1:0:2}" = -F ]; then
+ if [[ $1 == -F* ]]; then
if [ ${#1} -gt 2 ]; then
configfile="$(dequote "${1:2}")"
else
@@ -221,7 +221,7 @@ _sftp()
# Search COMP_WORDS for '-F configfile' argument
set -- "${words[@]}"
while [ $# -gt 0 ]; do
- if [ "${1:0:2}" = -F ]; then
+ if [[ $1 == -F* ]]; then
if [ ${#1} -gt 2 ]; then
configfile="$(dequote "${1:2}")"
else
@@ -351,7 +351,7 @@ _scp()
# Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument
set -- "${words[@]}"
while [ $# -gt 0 ]; do
- if [ "${1:0:2}" = -F ]; then
+ if [[ $1 == -F* ]]; then
if [ ${#1} -gt 2 ]; then
configfile="$(dequote "${1:2}")"
else