[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 04b7883f7dd06ffe1f45e90e430c7d3fa03b99b5

Ville Skyttä ville.skytta at iki.fi
Wed Dec 9 20:46:31 UTC 2009


The following commit has been merged in the master branch:
commit 04b7883f7dd06ffe1f45e90e430c7d3fa03b99b5
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Wed Dec 9 22:46:09 2009 +0200

    Use here strings instead of echos where appropriate (part of Alioth: #312143).

diff --git a/contrib/_modules b/contrib/_modules
index 33b367c..b6f51b0 100644
--- a/contrib/_modules
+++ b/contrib/_modules
@@ -23,13 +23,13 @@ have module || [ -f /etc/profile.d/modules.sh ] && {
 
 _module_list ()
 {
-    local modules="$( echo $LOADEDMODULES | sed 's/:/ /g' | sort )"
+    local modules="$( sed 's/:/ /g' <<<$LOADEDMODULES | sort )"
     compgen -W "$modules" -- $1
 }
 
 _module_path ()
 {
-    local modules="$( echo $MODULEPATH | sed 's/:/ /g' | sort )"
+    local modules="$( sed 's/:/ /g' <<<$MODULEPATH | sort )"
     compgen -W "$modules" -- $1
 }
 
diff --git a/contrib/findutils b/contrib/findutils
index 09d2f44..ea0c112 100644
--- a/contrib/findutils
+++ b/contrib/findutils
@@ -92,7 +92,7 @@ _find()
     # opposition to "tests" and "actions", as in the find(1) manpage).
     onlyonce=' -daystart -depth -follow -help -maxdepth -mindepth -mount \
        -noleaf -version -xdev '
-    COMPREPLY=( $( echo "${COMP_WORDS[@]}" | \
+    COMPREPLY=( $( \
            (while read -d ' ' i; do
             [[ -z "$i" || "${onlyonce/ ${i%% *} / }" == "$onlyonce" ]] &&
             continue
@@ -103,7 +103,7 @@ _find()
             # remove word from list of completions
             COMPREPLY=( ${COMPREPLY/ ${i%% *} / } )
             done
-            echo "${COMPREPLY[@]}")
+            echo "${COMPREPLY[@]}") <<<"${COMP_WORDS[@]}"
           ) )
 
     _filedir
diff --git a/contrib/gdb b/contrib/gdb
index 0cbf1ec..04e725c 100644
--- a/contrib/gdb
+++ b/contrib/gdb
@@ -20,8 +20,8 @@ _gdb()
             # functions and aliases. Thus we need to retrieve the program
             # names manually.
             IFS=":"
-            local path_array=( $( echo "$PATH" | \
-                sed -e 's/:\{2,\}/:/g' -e 's/^:\|:$//g' ) )
+            local path_array=( $( \
+                sed -e 's/:\{2,\}/:/g' -e 's/^:\|:$//g' <<<"$PATH" ) )
             IFS=$'\n'
             COMPREPLY=( $( compgen -d -W '$(find "${path_array[@]}" . \
                 -mindepth 1 -maxdepth 1 -not -type d -executable \
diff --git a/contrib/java b/contrib/java
index 068a918..58562f5 100644
--- a/contrib/java
+++ b/contrib/java
@@ -108,7 +108,7 @@ _java_packages()
         fi
     done
     # keep only packages
-    COMPREPLY=( $( echo "${COMPREPLY[@]}" | tr " " "\n" | grep "/$" ) )
+    COMPREPLY=( $( tr " " "\n" <<<"${COMPREPLY[@]}" | grep "/$" ) )
     # remove packages extension
     COMPREPLY=( ${COMPREPLY[@]%/} )
     # convert path syntax to package syntax
diff --git a/contrib/povray b/contrib/povray
index a2ff7b3..c56a71f 100644
--- a/contrib/povray
+++ b/contrib/povray
@@ -22,14 +22,14 @@ _povray()
             ;;
         [-+]O*)
             # guess what output file type user may want
-            case $( ( IFS=$'\n'; echo "${COMP_WORDS[*]}" | grep '^[-+]F' ) ) in
+            case $( ( IFS=$'\n'; grep '^[-+]F' <<<"${COMP_WORDS[*]}" ) ) in
                 [-+]FN) oext=png ;;
                 [-+]FP) oext=ppm ;;
                 [-+]F[CT]) oext=tga ;;
                 *) oext=$defoext ;;
             esac
             # complete filename corresponding to previously specified +I
-            COMPREPLY=( $( ( IFS=$'\n'; echo "${COMP_WORDS[*]}" | grep '^[-+]I' ) ) )
+            COMPREPLY=( $( ( IFS=$'\n'; grep '^[-+]I' <<<"${COMP_WORDS[*]}" ) ) )
             COMPREPLY=( ${COMPREPLY[@]#[-+]I} )
             COMPREPLY=( ${COMPREPLY[@]/%.pov/.$oext} )
             cur="${povcur#[-+]O}" # to confuse _filedir
diff --git a/contrib/sysv-rc b/contrib/sysv-rc
index a11c9b1..32634dd 100644
--- a/contrib/sysv-rc
+++ b/contrib/sysv-rc
@@ -19,14 +19,13 @@ _update_rc_d()
 
     if [[ $COMP_CWORD -eq 1 || "$prev" == -* ]]; then
     valid_options=( $( \
-        echo "${COMP_WORDS[@]} ${options[@]}" \
-        | tr " " "\n" \
-        | sed -ne "/$( echo "${options[@]}" | sed "s/ /\\|/g" )/p" \
+        tr " " "\n" <<<"${COMP_WORDS[@]} ${options[@]}" \
+        | sed -ne "/$( sed "s/ /\\|/g" <<<"${options[@]}" )/p" \
         | sort | uniq -u \
         ) )
     COMPREPLY=( $( compgen -W '${options[@]} ${services[@]}' \
-        -X '$( echo ${COMP_WORDS[@]} | tr " " "|" )' -- "$cur" ) )
-    elif [[ "$prev" == ?($( echo ${services[@]} | tr " " "|" )) ]]; then
+        -X '$( tr " " "|" <<<${COMP_WORDS[@]} )' -- "$cur" ) )
+    elif [[ "$prev" == ?($( tr " " "|" <<<${services[@]} )) ]]; then
         COMPREPLY=( $( compgen -W 'remove defaults start stop' -- "$cur" ) )
     elif [[ "$prev" == defaults && "$cur" == [0-9] ]]; then
         COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 )
@@ -86,9 +85,8 @@ _invoke_rc_d()
 
     if [[ ($COMP_CWORD -eq 1) || ("$prev" == --* ) ]]; then
     valid_options=( $( \
-        echo ${COMP_WORDS[@]} ${options[@]} \
-        | tr " " "\n" \
-        | sed -ne "/$( echo ${options[@]} | sed "s/ /\\\\|/g" )/p" \
+        tr " " "\n" <<<"${COMP_WORDS[@]} ${options[@]}" \
+        | sed -ne "/$( sed "s/ /\\\\|/g" <<<"${options[@]}" )/p" \
         | sort | uniq -u \
         ) )
     COMPREPLY=( $( compgen -W '${valid_options[@]} ${services[@]}' -- "$cur" ) )
diff --git a/contrib/tar b/contrib/tar
index 7ca80f7..cf0009c 100644
--- a/contrib/tar
+++ b/contrib/tar
@@ -45,7 +45,7 @@ _tar()
         # complete on files in tar file
         #
         # get name of tar file from command line
-        tar=$( echo "$COMP_LINE" | sed -e 's/^.* \([^ ]*'$regex'\) .*$/\1/' )
+        tar=$( sed -e 's/^.* \([^ ]*'$regex'\) .*$/\1/' <<<"$COMP_LINE" )
         # devise how to untar and list it
         untar=t${COMP_WORDS[1]//[^Izjyf]/}
 
diff --git a/contrib/vncviewer b/contrib/vncviewer
index 7e9c00d..dd2525a 100644
--- a/contrib/vncviewer
+++ b/contrib/vncviewer
@@ -114,8 +114,8 @@ _xvnc4viewer()
             # Variable 'nocasematch' isn't available;
             # Convert completions to lowercase
             COMPREPLY=( $( compgen -W "$(
-                echo ${options[@]/#/$dash} | tr [:upper:] [:lower:]
-                )" -- "$(echo "$cur" | tr [:upper:] [:lower:])" ) )
+                tr [:upper:] [:lower:] <<<${options[@]/#/$dash}
+                )" -- "$( tr [:upper:] [:lower:] <<<"$cur" )" ) )
         fi
     else
         _known_hosts_real "$cur"

-- 
bash-completion



More information about the Bash-completion-commits mailing list