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

Ville Skyttä ville.skytta at iki.fi
Mon Jan 4 16:21:00 UTC 2010


The following commit has been merged in the master branch:
commit db739401f78f5479ece0eb7a7a0ef725d89d2e2d
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Mon Jan 4 18:00:46 2010 +0200

    sed portability fixes.
    
    Use \{0,1\} (POSIX BRE) instead of \? or empty subexpression alternatives.

diff --git a/bash_completion b/bash_completion
index 6b2f28f..e047674 100644
--- a/bash_completion
+++ b/bash_completion
@@ -764,7 +764,7 @@ _modules()
     local modpath
     modpath=/lib/modules/$1
     COMPREPLY=( $( compgen -W "$( command ls -R $modpath | \
-        sed -ne 's/^\(.*\)\.k\?o\(\|.gz\)$/\1/p' )" -- "$cur" ) )
+        sed -ne 's/^\(.*\)\.k\{0,1\}o\(\.gz\)\{0,1\}$/\1/p' )" -- "$cur" ) )
 }
 
 # This function completes on installed modules
@@ -1376,7 +1376,7 @@ _known_hosts_real()
 
     # append any available aliases from config files
     if [[ ${#config[@]} -gt 0 && -n "$aliases" ]]; then
-        local hosts=$( sed -ne 's/^[ \t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\?['"$'\t '"']\{1,\}\([^#*?]*\)\(#.*\)\?$/\2/p' "${config[@]}" )
+        local hosts=$( sed -ne 's/^[ \t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\{0,1\}['"$'\t '"']\{1,\}\([^#*?]*\)\(#.*\)\{0,1\}$/\2/p' "${config[@]}" )
         COMPREPLY=( "${COMPREPLY[@]}" $( compgen  -P "$prefix$user" \
             -S "$suffix" -W "$hosts" -- "$cur" ) )
     fi
diff --git a/contrib/_yum b/contrib/_yum
index eac9014..2bcf950 100644
--- a/contrib/_yum
+++ b/contrib/_yum
@@ -31,7 +31,7 @@ _yum_repolist()
 _yum_plugins()
 {
     command ls /usr/lib/yum-plugins/*.py{,c,o} 2>/dev/null \
-        | sed -ne 's|.*/\([^./]*\)\.py[co]\?$|\1|p' | sort -u
+        | sed -ne 's|.*/\([^./]*\)\.py[co]\{0,1\}$|\1|p' | sort -u
 }
 
 _yum()

-- 
bash-completion



More information about the Bash-completion-commits mailing list