From db739401f78f5479ece0eb7a7a0ef725d89d2e2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Mon, 4 Jan 2010 18:00:46 +0200 Subject: [PATCH] sed portability fixes. Use \{0,1\} (POSIX BRE) instead of \? or empty subexpression alternatives. --- bash_completion | 4 ++-- contrib/_yum | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bash_completion b/bash_completion index 6b2f28f7..e0476743 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 eac90144..2bcf9502 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()