From 0eb75b414fe0bc6a829b8b24b0f59b80ed1513e7 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Wed, 10 Nov 2010 18:24:53 +0100 Subject: [PATCH 1/2] bug #389: detect linux to use -e parameter --- src/tm_mad/tm_common.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/tm_mad/tm_common.sh b/src/tm_mad/tm_common.sh index 32628fb7b1..62e6ffc527 100644 --- a/src/tm_mad/tm_common.sh +++ b/src/tm_mad/tm_common.sh @@ -39,6 +39,12 @@ SSH=/usr/bin/ssh SUDO=/usr/bin/sudo WGET=/usr/bin/wget +if [ "x$(uname -s)" = "xLinux" ]; then + SED="$SED -e" +else + SED="/usr/bin/sed -E" +fi + function get_vmdir { VMDIR=`grep '^VM_DIR=' $ONE_LOCAL_VAR/config | cut -d= -f2` @@ -49,7 +55,7 @@ function get_vmdir # /some//path///somewhere/ -> /some/path/somewhere function fix_dir_slashes { - dirname "$1/file" | sed -E 's/\/+/\//g' + dirname "$1/file" | $SED 's/\/+/\//g' } function fix_var_slashes @@ -118,13 +124,13 @@ function error_message # Gets the host from an argument function arg_host { - echo $1 | $SED -e 's/^\([^:]*\):.*$/\1/' + echo $1 | $SED 's/^\([^:]*\):.*$/\1/' } # Gets the path from an argument function arg_path { - echo $1 | $SED -e 's/^[^:]*:\(.*\)$/\1/' + echo $1 | $SED 's/^[^:]*:\(.*\)$/\1/' } # Executes a command, if it fails return error message and exits From ddba29f0f050feceae94bc37c19446f783b6fb15 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Fri, 12 Nov 2010 19:37:24 +0100 Subject: [PATCH 2/2] bug #389: use -r option in GNU sed to make it work with extended regexps --- src/tm_mad/tm_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tm_mad/tm_common.sh b/src/tm_mad/tm_common.sh index 62e6ffc527..47a80cc29b 100644 --- a/src/tm_mad/tm_common.sh +++ b/src/tm_mad/tm_common.sh @@ -40,7 +40,7 @@ SUDO=/usr/bin/sudo WGET=/usr/bin/wget if [ "x$(uname -s)" = "xLinux" ]; then - SED="$SED -e" + SED="$SED -r" else SED="/usr/bin/sed -E" fi