]> git.stg.codes - stg.git/commitdiff
Portable sed.
authorMaxim Mamontov <faust.madf@gmail.com>
Sat, 25 Oct 2014 02:13:21 +0000 (05:13 +0300)
committerMaxim Mamontov <faust.madf@gmail.com>
Sat, 25 Oct 2014 02:13:21 +0000 (05:13 +0300)
functest/functions
functest/test.sh

index 51a1fd32477b20231326eed90d42a6402ac49e88..a90b9dcd54686e0cc39c488ea42615c24281a400 100644 (file)
@@ -40,3 +40,8 @@ count()
         printf "$RES"
     fi
 }
         printf "$RES"
     fi
 }
+
+subst()
+{
+    sed -i "s|$1|$2|g" "$3" 2> /dev/null || sed -i "" "s|$1|$2|g" "$3"
+}
index 921fa3f244eeda64e3b32cd70c55b7effce407ae..84816ef440605a275a1d4caf805113d2fd1f34c7 100755 (executable)
@@ -2,6 +2,8 @@
 
 BASEPATH=$1
 
 
 BASEPATH=$1
 
+source `dirname $0`/functions
+
 if [ "$BASEPATH" == "" ]
 then
     printf "Usage: $0 <path>\n"
 if [ "$BASEPATH" == "" ]
 then
     printf "Usage: $0 <path>\n"
@@ -36,8 +38,8 @@ then
     GROUP=wheel
 fi
 
     GROUP=wheel
 fi
 
-sed -i "" "s|-STG-PATH-|$STGPATH|g" "$STGPATH/stargazer.conf"
-sed -i "" "s|-STG-GROUP-|$GROUP|g" "$STGPATH/stargazer.conf"
+subst "-STG-PATH-" "$STGPATH" "$STGPATH/stargazer.conf"
+subst "-STG-GROUP-" "$GROUP" "$STGPATH/stargazer.conf"
 
 CURPATH=`pwd`
 LOGFILE="$CURPATH/"`date "+%Y-%m-%d-%H%M%S.console.log"`
 
 CURPATH=`pwd`
 LOGFILE="$CURPATH/"`date "+%Y-%m-%d-%H%M%S.console.log"`