X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=integration%2Fsrc%2Frelease_scripts%2FupdateParentRef.sh;h=0f72aa53b7fe45dcffa020b10fdfc0d509c7519f;hb=d7d9a664cb6d45b1019f8ac897feac512e5b37e8;hp=1978e33dc651af4c6d74d7dd752f09f171f1c9b6;hpb=81c2c515c4c92cb77d7bc31eb2f2771ca2063216;p=policy%2Fparent.git
diff --git a/integration/src/release_scripts/updateParentRef.sh b/integration/src/release_scripts/updateParentRef.sh
index 1978e33d..0f72aa53 100755
--- a/integration/src/release_scripts/updateParentRef.sh
+++ b/integration/src/release_scripts/updateParentRef.sh
@@ -22,7 +22,15 @@
set -e
-SCRIPT_NAME=`basename $0`
+SCRIPT_NAME=$(basename "$0")
+
+# Use the bash internal OSTYPE variable to check for MacOS
+if [[ "$OSTYPE" == "darwin"* ]]
+then
+ SED="gsed"
+else
+ SED="sed"
+fi
usage()
{
@@ -99,22 +107,24 @@ then
exit 1
fi
-pom_lines=`wc -l $pom_file | sed 's/^[ \t]*//' | cut -f1 -d' '`
-parent_start_line=`grep -n '^[\t ]*[\t*]*$' $pom_file | cut -f1 -d':'`
-parent_end_line=`grep -n '^[\t ]*[\t*]*$' $pom_file | cut -f1 -d':'`
+pom_lines=$(wc -l "$pom_file" | $SED 's/^[ \t]*//' | cut -f1 -d' ')
+parent_start_line=$(grep -n '^[\t ]*[\t ]*$' "$pom_file" | cut -f1 -d':')
+parent_end_line=$(grep -n '^[\t ]*[\t ]*$' "$pom_file" | cut -f1 -d':')
pom_head_lines=$((parent_start_line-1))
pom_tail_lines=$((pom_lines-parent_end_line))
pom_temp_file=$(mktemp)
-head -$pom_head_lines $pom_file > $pom_temp_file
-echo " " >> $pom_temp_file
-echo " $group_id" >> $pom_temp_file
-echo " $artifact_id" >> $pom_temp_file
-echo " $version" >> $pom_temp_file
-echo " " >> $pom_temp_file
-echo " " >> $pom_temp_file
-tail -$pom_tail_lines $pom_file >> $pom_temp_file
+{
+ head -$pom_head_lines "$pom_file"
+ echo " "
+ echo " $group_id"
+ echo " $artifact_id"
+ echo " $version"
+ echo " "
+ echo " "
+ tail -$pom_tail_lines "$pom_file"
+} > "$pom_temp_file"
-mv $pom_temp_file $pom_file
+mv "$pom_temp_file" "$pom_file"