[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 5b54c41de55300fb7c28b435b0e7a595ab1cd7d9

Ville Skyttä ville.skytta at iki.fi
Tue Nov 3 20:49:30 UTC 2009


The following commit has been merged in the master branch:
commit 4790b1a0c684e115f3b06737cb879e4dfe0166ea
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Tue Nov 3 22:04:46 2009 +0200

    sed usage portability fixes: avoid \+

diff --git a/CHANGES b/CHANGES
index 4b09e15..8cdaf7e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -37,6 +37,7 @@ bash-completion (2.x)
     input in external command arguments (Debian: 552631).
   * Add /sbin to $PATH when invoking ifconfig and iwconfig.
   * Combine dcop and qdbus completions into the latter.
+  * sed usage portability fixes.
 
   [ Freddy Vulto ]
   * Added _get_pword() helper function, thanks to Sung Pae (Alioth: #312030)
diff --git a/bash_completion b/bash_completion
index 7521a0e..eb14cf7 100644
--- a/bash_completion
+++ b/bash_completion
@@ -480,7 +480,7 @@ _configured_interfaces()
 {
     if [ -f /etc/debian_version ]; then
         # Debian system
-        COMPREPLY=( $( compgen -W "$( sed -ne 's|^iface \([^ ]\+\).*$|\1|p' \
+        COMPREPLY=( $( compgen -W "$( sed -ne 's|^iface \([^ ]\{1,\}\).*$|\1|p'\
             /etc/network/interfaces )" -- "$cur" ) )
     elif [ -f /etc/SuSE-release ]; then
         # SuSE system
@@ -1312,7 +1312,7 @@ _known_hosts_real()
         fi
         # append any available aliases from config files
         if [ ${#config[@]} -gt 0 ] && [ -n "$aliases" ]; then
-            local host_aliases=$( sed -ne 's/^[ \t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\?['"$'\t '"']\+\([^#*?]*\)\(#.*\)\?$/\2/p' "${config[@]}" )
+            local host_aliases=$( sed -ne 's/^[ \t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\?['"$'\t '"']\{1,\}\([^#*?]*\)\(#.*\)\?$/\2/p' "${config[@]}" )
             hosts=$( compgen -W "$host_aliases" -- "$cur" )
             COMPREPLY=( "${COMPREPLY[@]}" $hosts )
         fi
@@ -1526,7 +1526,7 @@ _longopt()
 
     if [[ "$cur" == -* ]]; then
         COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | sed -e '/--/!d' \
-            -e 's/.*\(--[-A-Za-z0-9]\+\).*/\1/' |sort -u )"\
+            -e 's/.*\(--[-A-Za-z0-9]\{1,\}\).*/\1/' | sort -u )" \
             -- "$cur" ) )
     elif [[ "$1" == rmdir ]]; then
         _filedir -d
diff --git a/contrib/_yum b/contrib/_yum
index 63fe065..d566d1f 100644
--- a/contrib/_yum
+++ b/contrib/_yum
@@ -22,7 +22,7 @@ _yum_repolist()
     # http://yum.baseurl.org/ticket/83
     # Drop first ("repo id      repo name") and last ("repolist: ...") rows
     yum --noplugins -C repolist $1 2>/dev/null | \
-        sed -ne '/^repo\(\s\+id\|list:\)/d' -e 's/[[:space:]].*//p'
+        sed -ne '/^repo\(\s\s*id\|list:\)/d' -e 's/[[:space:]].*//p'
 }
 
 _yum_plugins()
diff --git a/contrib/gdb b/contrib/gdb
index ddb7348..8c8cb8d 100644
--- a/contrib/gdb
+++ b/contrib/gdb
@@ -20,7 +20,8 @@ _gdb()
             # functions and aliases. Thus we need to retrieve the program
             # names manually.
             IFS=":"
-            local path_array=( $(echo "$PATH" | sed 's/::\+/:/g;s/^:\|:$//g') )
+            local path_array=( $( echo "$PATH" | \
+                sed 's/:\{2,\}/:/g;s/^:\|:$//g' ) )
             IFS=$'\n'
             COMPREPLY=( $( compgen -d -W '$(find "${path_array[@]}" . \
                 -mindepth 1 -maxdepth 1 -not -type d -executable \
diff --git a/contrib/iptables b/contrib/iptables
index e5c0486..25ab35a 100644
--- a/contrib/iptables
+++ b/contrib/iptables
@@ -8,7 +8,7 @@ _iptables()
     COMPREPLY=()
     cur=`_get_cword`
     prev=${COMP_WORDS[COMP_CWORD-1]}
-    chain='s/^Chain \([^ ]\+\).*$/\1/p'
+    chain='s/^Chain \([^ ]\{1,\}\).*$/\1/p'
 
     if [[ $COMP_LINE == *-t\ *filter* ]]; then
         table="-t filter"
@@ -23,7 +23,7 @@ _iptables()
     case "$prev" in
     -*[AIDRPFXLZ])
         COMPREPLY=( $( compgen -W '`iptables $table -nL | \
-                sed -ne "s/^Chain \([^ ]\+\).*$/\1/p"`' -- "$cur" ) )
+                sed -ne "s/^Chain \([^ ]\{1,\}\).*$/\1/p"`' -- "$cur" ) )
         ;;
     -*t)
         COMPREPLY=( $( compgen -W 'nat filter mangle' -- "$cur" ) )
diff --git a/contrib/kldload b/contrib/kldload
index cda38ba..ff5ced1 100644
--- a/contrib/kldload
+++ b/contrib/kldload
@@ -23,7 +23,8 @@ _kldunload()
 {
     local cur
     cur=`_get_cword`
-    COMPREPLY=( $(kldstat | sed -ne "s/^.*[ \t]\+\($cur[a-z_]\+\).ko$/\1/p") )
+    COMPREPLY=( $( kldstat | \
+        sed -ne "s/^.*[ \t]\{1,\}\($cur[a-z_]\{1,\}\).ko$/\1/p" ) )
 }
 complete -F _kldunload -o filenames kldunload
 
diff --git a/contrib/mock b/contrib/mock
index 7ea299c..bb8f0d3 100644
--- a/contrib/mock
+++ b/contrib/mock
@@ -47,7 +47,7 @@ _mock()
             # This would actually depend on what the target root
             # can be used to build for...
             COMPREPLY=( $( compgen -W "$( command rpm --showrc | \
-                sed -ne 's/^\s*compatible\s\+archs\s*:\s*\(.*\)/\1/i p' )" \
+                sed -ne 's/^\s*compatible\s\s*archs\s*:\s*\(.*\)/\1/i p' )" \
                 -- "$cur" ) )
             return 0
             ;;
diff --git a/contrib/rpm b/contrib/rpm
index 686a90a..9338c28 100644
--- a/contrib/rpm
+++ b/contrib/rpm
@@ -11,7 +11,7 @@ _rpm_installed_packages()
         /var/log/rpmpkgs -nt /var/lib/rpm/Packages ]; then
         # using RHL 7.2 or later - this is quicker than querying the DB
         COMPREPLY=( $( sed -ne \
-            's|^\('$cur'[^[:space:]]*\)-[^[:space:]-]\+-[^[:space:]-]\+\.rpm$|\1|p' \
+            's|^\('$cur'[^[:space:]]*\)-[^[:space:]-]\{1,\}-[^[:space:]-]\{1,\}\.rpm$|\1|p' \
             /var/log/rpmpkgs ) )
     elif type rpmqpack &>/dev/null ; then
         # SUSE's rpmqpack is faster than rpm -qa
@@ -97,7 +97,7 @@ _rpm()
         --eval|-E)
             # get a list of macros
             COMPREPLY=( $( rpm --showrc | sed -ne \
-                's/^-\?[0-9]\+[:=][[:space:]]\+\('${cur#%}'[^[:space:](]*\).*/\1/p' ) )
+                's/^-\?[0-9]\{1,\}[:=][[:space:]]\{1,\}\('${cur#%}'[^[:space:](]*\).*/\1/p' ) )
             COMPREPLY=( "${COMPREPLY[@]/#/%}" )
             return 0
             ;;
@@ -139,7 +139,7 @@ _rpm()
             ;;
         --target)
             COMPREPLY=( $( compgen -W "$( command rpm --showrc | sed -ne \
-                's/^\s*compatible\s\+build\s\+archs\s*:\s*\(.*\)/\1/ p' )" \
+                's/^\s*compatible\s\s*build\s\s*archs\s*:\s*\(.*\)/\1/ p' )" \
                 -- "$cur" ) )
             return 0
             ;;
diff --git a/contrib/screen b/contrib/screen
index b08c926..53a0fde 100644
--- a/contrib/screen
+++ b/contrib/screen
@@ -12,7 +12,7 @@ _screen_sessions()
     fi
 
     COMPREPLY=( $( command screen -ls | sed -ne \
-        's|^['$'\t'']\+\('"$cur"'[0-9]\+\.[^'$'\t'']\+\)'"$pattern"'$|\1|p' ) )
+        's|^['$'\t'']\{1,\}\('"$cur"'[0-9]\{1,\}\.[^'$'\t'']\{1,\}\)'"$pattern"'$|\1|p' ) )
 } &&
 _screen()
 {
diff --git a/test/lib/library.sh b/test/lib/library.sh
index 41ebc8e..581ce4b 100644
--- a/test/lib/library.sh
+++ b/test/lib/library.sh
@@ -7,10 +7,10 @@
 # @param $1  Additional sed script
 diff_env() {
 	diff "$1" "$2" | sed -e "
-	/^[0-9,]\+[acd]/d  # Remove diff line indicators
-	/---/d            # Remove diff block separators
-	/[<>] _=/d        # Remove underscore variable
-	/[<>] PPID=/d     # Remove PPID bash variable
+	/^[0-9,]\{1,\}[acd]/d  # Remove diff line indicators
+	/---/d                 # Remove diff block separators
+	/[<>] _=/d             # Remove underscore variable
+	/[<>] PPID=/d          # Remove PPID bash variable
 	$3"
 } # diff_env()
 

-- 
bash-completion



More information about the Bash-completion-commits mailing list