sed portability fixes.

Use \{0,1\} (POSIX BRE) instead of \? or empty subexpression alternatives.
This commit is contained in:
Ville Skyttä 2010-01-04 18:00:46 +02:00
parent 4ec77ce531
commit db739401f7
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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()