-head -$pom_head_lines $pom_file > $pom_temp_file
-echo " <parent>" >> $pom_temp_file
-echo " <groupId>$group_id</groupId>" >> $pom_temp_file
-echo " <artifactId>$artifact_id</artifactId>" >> $pom_temp_file
-echo " <version>$version</version>" >> $pom_temp_file
-echo " <relativePath />" >> $pom_temp_file
-echo " </parent>" >> $pom_temp_file
-tail -$pom_tail_lines $pom_file >> $pom_temp_file
-
-mv $pom_temp_file $pom_file
+{
+ head -$pom_head_lines "$pom_file"
+ echo " <parent>"
+ echo " <groupId>$group_id</groupId>"
+ echo " <artifactId>$artifact_id</artifactId>"
+ echo " <version>$version</version>"
+ echo " <relativePath />"
+ echo " </parent>"
+ tail -$pom_tail_lines "$pom_file"
+} > "$pom_temp_file"
+
+mv "$pom_temp_file" "$pom_file"