diff options
author | liamfallon <liam.fallon@est.tech> | 2022-01-12 13:24:54 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2022-01-17 12:17:19 +0000 |
commit | b76315a09b466166a6eec6f0b22f58d3e432c7b9 (patch) | |
tree | 7ee40804ba9dc245237b2047064516bf9c849d9e /integration | |
parent | 0c3008fd6b925edc26c282901fafac17d516abff (diff) |
Add release script, fix sed for MacOS
This commit:
- Adds a releease phase script that somewhat automates releases
- updates the scritps to use GNU sed on MacOS
Issue-ID: POLICY-3835
Change-Id: I2b79c6a3cc3476280ac00a2288e3cb8686ee976a
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'integration')
-rwxr-xr-x | integration/src/release_scripts/bumpSnapshots.sh | 27 | ||||
-rwxr-xr-x | integration/src/release_scripts/getReleaseData.sh | 16 | ||||
-rwxr-xr-x | integration/src/release_scripts/mkart.sh | 18 | ||||
-rwxr-xr-x | integration/src/release_scripts/mkdock.sh | 20 | ||||
-rwxr-xr-x | integration/src/release_scripts/releasePhase.sh | 193 | ||||
-rwxr-xr-x | integration/src/release_scripts/releaseRepoImages.sh | 4 | ||||
-rwxr-xr-x | integration/src/release_scripts/updateOomImages.sh | 10 | ||||
-rwxr-xr-x | integration/src/release_scripts/updateParentRef.sh | 14 | ||||
-rwxr-xr-x | integration/src/release_scripts/updateRefs.sh | 29 |
9 files changed, 292 insertions, 39 deletions
diff --git a/integration/src/release_scripts/bumpSnapshots.sh b/integration/src/release_scripts/bumpSnapshots.sh index f8317e2a..ced6453c 100755 --- a/integration/src/release_scripts/bumpSnapshots.sh +++ b/integration/src/release_scripts/bumpSnapshots.sh @@ -26,6 +26,14 @@ SCRIPT_NAME=`basename $0` repo_location="./" release_data_file="./pf_release_data.csv" +# Use the bash internal OSTYPE variable to check for MacOS +if [[ "$OSTYPE" == "darwin"* ]] +then + SED="gsed" +else + SED="sed" +fi + declare -a pf_repos=( "policy/parent" "policy/docker" @@ -146,9 +154,9 @@ do if [ "$latest_released_tag" = "$next_release_version" ] then - declare -i major_version=`echo $next_release_version | sed -E 's/^([0-9]*)\.[0-9]*\.[0-9]*$/\1/'` - declare -i minor_version=`echo $next_release_version | sed -E 's/^[0-9]*\.([0-9]*)\.[0-9]*$/\1/'` - declare -i patch_version=`echo $next_release_version | sed -E 's/^[0-9]*\.[0-9]*\.([0-9]*)$/\1/'` + declare -i major_version=`echo $next_release_version | $SED -E 's/^([0-9]*)\.[0-9]*\.[0-9]*$/\1/'` + declare -i minor_version=`echo $next_release_version | $SED -E 's/^[0-9]*\.([0-9]*)\.[0-9]*$/\1/'` + declare -i patch_version=`echo $next_release_version | $SED -E 's/^[0-9]*\.[0-9]*\.([0-9]*)$/\1/'` declare -i new_patch_version=$(($patch_version+1)) new_snapshot_tag="$major_version"."$minor_version"."$new_patch_version"-SNAPSHOT @@ -161,15 +169,20 @@ do temp_file=$(mktemp) echo updating snapshot version of repo $repo in $repo_location/$repo/version.properties - sed -e "s/patch=$patch_version/patch=$new_patch_version/" $repo_location/$repo/version.properties > $temp_file + $SED -e "s/patch=$patch_version/patch=$new_patch_version/" $repo_location/$repo/version.properties > $temp_file mv $temp_file $repo_location/$repo/version.properties fi updateRefs.sh -pcmos -d $release_data_file -l $repo_location -r $repo - git -C $repo_location/$specified_repo status | grep '^[ \t]*modified:[ \t]*pom.xml' > /dev/null 2>&1 - references_updated=$? - if [ "$latest_released_tag" != "$next_release_version" ] && [ $references_updated -eq 0 ] + if [ "$(git -C $repo_location/$specified_repo status | grep '^[ \t]*modified:[ \t]*pom.xml' > /dev/null 2>&1)" = 0 ] + then + references_updated=0 + else + references_updated=1 + fi + + if [ "$latest_released_tag" != "$next_release_version" ] && [ $references_updated -ne 0 ] then continue fi diff --git a/integration/src/release_scripts/getReleaseData.sh b/integration/src/release_scripts/getReleaseData.sh index dce8fa2c..3d3bad9d 100755 --- a/integration/src/release_scripts/getReleaseData.sh +++ b/integration/src/release_scripts/getReleaseData.sh @@ -26,6 +26,14 @@ SCRIPT_NAME=`basename $0` repo_location="./" release_data_file="./pf_release_data.csv" +# Use the bash internal OSTYPE variable to check for MacOS +if [[ "$OSTYPE" == "darwin"* ]] +then + SED="gsed" +else + SED="sed" +fi + declare -a pf_repos=( "policy/parent" "policy/docker" @@ -138,7 +146,7 @@ get_tags() { latest_snapshot_tag=`mvn -f $repo_location/$repo clean | \ grep "SNAPSHOT" | \ tail -1 | \ - sed -r 's/^.* ([0-9]*\.[0-9]*\.[0-9]*-SNAPSHOT).*$/\1/'` + $SED -r 's/^.* ([0-9]*\.[0-9]*\.[0-9]*-SNAPSHOT).*$/\1/'` changed_files=`git -C $repo_location/$repo diff --name-only $latest_released_tag origin/master | \ grep -v 'pom.xml$' | \ @@ -146,14 +154,14 @@ get_tags() { grep -v "^releases/$latest_released_tag.yaml$" | \ grep -v "^releases/$latest_released_tag-container.yaml$" | \ wc -l | \ - sed 's/^[[:space:]]*//g'` + $SED 's/^[[:space:]]*//g'` if [ -f $repo_location/$repo/releases/$latest_released_tag-container.yaml ] then docker_images=`grep '\- name:' $repo_location/$repo/releases/$latest_released_tag-container.yaml | \ - sed -e 's/\- //g' -e 's/\://g' -e "s/\'//g" -e 's/^[[:space:]]*//g' -e 's/^name //' | \ + $SED -e 's/\- //g' -e 's/\://g' -e "s/\'//g" -e 's/^[[:space:]]*//g' -e 's/^name //' | \ tr '\n' ':' | \ - sed 's/:$//'` + $SED 's/:$//'` else docker_images="" fi diff --git a/integration/src/release_scripts/mkart.sh b/integration/src/release_scripts/mkart.sh index 48a368ec..62ec0302 100755 --- a/integration/src/release_scripts/mkart.sh +++ b/integration/src/release_scripts/mkart.sh @@ -36,6 +36,14 @@ # can get through the firewall. # +# Use the bash internal OSTYPE variable to check for MacOS +if [[ "$OSTYPE" == "darwin"* ]] +then + SED="gsed" +else + SED="sed" +fi + set -e has_docker_images=false @@ -60,20 +68,20 @@ fi echo Branch: ${BRANCH} PROJECT=$(awk -F= '$1 == "project" { print $2 }' "${TOPDIR}/.gitreview" | - sed 's/.git$//') + $SED 's/.git$//') if [ -z "${PROJECT}" ]; then echo "cannot extract project from ${TOPDIR}/.gitreview" >&2 exit 1 fi echo Project: ${PROJECT} -TPROJ=$(echo ${PROJECT} | sed 's!/!%2F!') -DPROJ=$(echo ${PROJECT} | sed 's!/!-!') +TPROJ=$(echo ${PROJECT} | $SED 's!/!%2F!') +DPROJ=$(echo ${PROJECT} | $SED 's!/!-!') VERSION=$( xmllint --xpath \ '/*[local-name()="project"]/*[local-name()="version"]/text()' \ "${TOPDIR}/pom.xml" | - sed 's!-SNAPSHOT!!' + $SED 's!-SNAPSHOT!!' ) if [ -z "${VERSION}" ]; then echo "cannot extract version from ${TOPDIR}/pom.xml" >&2 @@ -85,7 +93,7 @@ prefix='https://jenkins.onap.org/view/policy/job/' STAGE_ID=$( curl --silent ${prefix}${DPROJ}-maven-stage-${BRANCH}/ | grep "Last completed build" | - sed -e 's!.*Last completed build .#!!' -e 's!).*!!' | + $SED -e 's!.*Last completed build .#!!' -e 's!).*!!' | head -1 ) if [ -z "${STAGE_ID}" ]; then diff --git a/integration/src/release_scripts/mkdock.sh b/integration/src/release_scripts/mkdock.sh index dfbee9f8..4f1b3e2c 100755 --- a/integration/src/release_scripts/mkdock.sh +++ b/integration/src/release_scripts/mkdock.sh @@ -39,6 +39,14 @@ set -e +# Use the bash internal OSTYPE variable to check for MacOS +if [[ "$OSTYPE" == "darwin"* ]] +then + SED="gsed" +else + SED="sed" +fi + if [ $# -lt 1 -o "$1" = "-?" ] then echo "arg(s): docker-container-name1 docker-container-name2 ..." >&2 @@ -59,20 +67,20 @@ fi echo Branch: ${BRANCH} PROJECT=$(awk -F= '$1 == "project" { print $2 }' "${TOPDIR}/.gitreview" | - sed 's/.git$//') + $SED 's/.git$//') if [ -z "${PROJECT}" ]; then echo "cannot extract project from ${TOPDIR}/.gitreview" >&2 exit 1 fi echo Project: ${PROJECT} -TPROJ=$(echo ${PROJECT} | sed 's!/!%2F!') -DPROJ=$(echo ${PROJECT} | sed 's!/!-!') +TPROJ=$(echo ${PROJECT} | $SED 's!/!%2F!') +DPROJ=$(echo ${PROJECT} | $SED 's!/!-!') RELEASE=$( xmllint --xpath \ '/*[local-name()="project"]/*[local-name()="version"]/text()' \ "${TOPDIR}/pom.xml" | - sed 's!-SNAPSHOT!!' + $SED 's!-SNAPSHOT!!' ) if [ -z "${RELEASE}" ]; then echo "cannot extract release from ${TOPDIR}/pom.xml" >&2 @@ -91,7 +99,7 @@ prefix='https://jenkins.onap.org/view/policy/job/' STAGE_ID=$( curl --silent ${prefix}${DPROJ}-maven-docker-stage-${BRANCH}/ | grep "Last completed build" | - sed -e 's!.*Last completed build .#!!' -e 's!).*!!' | + $SED -e 's!.*Last completed build .#!!' -e 's!).*!!' | head -1 ) if [ -z "${STAGE_ID}" ]; then @@ -129,7 +137,7 @@ do found == 1 && /Tag with/ { print } " | head -1 | - sed 's!.*Tag with!!' | + $SED 's!.*Tag with!!' | cut -d, -f2 ) if [ -z "${VERSION}" ]; then diff --git a/integration/src/release_scripts/releasePhase.sh b/integration/src/release_scripts/releasePhase.sh new file mode 100755 index 00000000..26a4588e --- /dev/null +++ b/integration/src/release_scripts/releasePhase.sh @@ -0,0 +1,193 @@ +#!/bin/bash + +# +# ============LICENSE_START================================================ +# ONAP +# ========================================================================= +# Copyright (C) 2022 Nordix Foundation. +# ========================================================================= +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END================================================== +# + +set -e + +SCRIPT_NAME=`basename $0` +repo_location="./" +release_data_file="./pf_release_data.csv" + +usage() +{ + echo "" + echo "$SCRIPT_NAME - execute a certain policy framework release phase" + echo "" + echo " usage: $SCRIPT_NAME [-options]" + echo "" + echo " options" + echo " -h - this help message" + echo " -d data_file - the policy release data file to use, defaults to '$release_data_file'" + echo " -l location - the location of the policy framework repos on the file system," + echo " defaults to '$repo_location'" + echo " -i issue-id - issue ID in the format POLICY-nnnn" + echo " -p phase - the release phase, a positive integer" + echo "" + echo " examples:" + echo " $SCRIPT_NAME -l /home/user/onap -d /home/user/data/pf_release_data.csv -i POLICY-1234 -p 3" + echo " perform release phase 3 on the repos at location '/home/user/onap' using the release data" + echo " in the file '/home/user/data/pf_release_data.csv'" + exit 255; +} + +while getopts "hd:l:i:p:" opt +do + case $opt in + h) + usage + ;; + d) + release_data_file=$OPTARG + ;; + l) + repo_location=$OPTARG + ;; + i) + issue_id=$OPTARG + ;; + p) + release_phase=$OPTARG + ;; + \?) + usage + exit 1 + ;; + esac +done + +if [ $OPTIND -eq 1 ] +then + echo "no arguments were specified" + usage +fi + +if [[ -z "$repo_location" ]] +then + echo "policy repo location not specified on -l flag" + exit 1 +fi + +if ! [ -d "$repo_location" ] +then + echo "policy repo location '$repo_location' not found" + exit 1 +fi + +if [[ -z "$release_data_file" ]] +then + echo "policy release data file not specified on -d flag" + exit 1 +fi + +if ! [ -f "$release_data_file" ] +then + echo "policy release data file '$release_data_file' not found" + exit 1 +fi + +if [ -z "$issue_id" ] +then + echo "issue_id not specified on -i flag" + exit 1 +fi + +if ! echo "$issue_id" | grep -Eq '^POLICY-[0-9]*$' +then + echo "issue ID is invalid, it should be of form 'POLICY-nnnn'" + exit 1 +fi + +if [ -z "$release_phase" ] +then + echo "release_phase not specified on -p flag" + exit 1 +fi + +if ! [[ "$release_phase" =~ ^[0-9]+$ ]] +then + echo "release_phase is invalid, it should be a positive integer" + exit 1 +fi + +release_phase_1() { + echo "Updating parent references in the parent pom and generating commit . . ." + updateRefs.sh -d $release_data_file -l $repo_location -r policy/parent -p + generateCommit.sh \ + -l $repo_location \ + -r policy/parent \ + -i $issue_id \ + -e "update parent references in policy/parent pom" \ + -m "updated the parent references in the policy/parent pom" + echo "Updated parent references in the parent pom and generated commit" +} + +release_phase_2() { + echo "Generating artifact release yaml file and commit for policy/parent . . ." + releaseRepo.sh -d $release_data_file -l $repo_location -r policy/parent -i $issue_id + echo "Generated artifact release yaml file and commit for policy/parent" +} + +release_phase_3() { + echo "Updating snapshots for policy/parent, updating references on policy/docker and policy/common . . ." + bumpSnapshots.sh \ + -d $release_data_file \ + -l $repo_location \ + -i $issue_id + updateRefs.sh \ + -p \ + -d $release_data_file \ + -l $repo_location \ + -r policy/docker + updateRefs.sh \ + -p \ + -d $release_data_file \ + -l $repo_location \ + -r policy/common + generateCommit.sh \ + -l $repo_location \ + -r policy/docker \ + -i $issue_id \ + -e "update parent references in policy/docker pom" \ + -m "updated the parent references in the policy/docker pom" + generateCommit.sh \ + -l $repo_location \ + -r policy/common \ + -i $issue_id \ + -e "update parent references in policy/common pom" \ + -m "updated the parent references in the policy/common pom" + echo "Updated snapshots for policy/parent, updating references on policy/docker and policy/common" +} + +case "$release_phase" in + +1) release_phase_1 + ;; + +2) release_phase_2 + ;; + +3) release_phase_3 + ;; + +*) echo "specified release phase '$release_phase' is invalid" + ;; +esac + diff --git a/integration/src/release_scripts/releaseRepoImages.sh b/integration/src/release_scripts/releaseRepoImages.sh index 8dc59543..d7c5bea3 100755 --- a/integration/src/release_scripts/releaseRepoImages.sh +++ b/integration/src/release_scripts/releaseRepoImages.sh @@ -29,8 +29,8 @@ release_data_file="./pf_release_data.csv" usage() { echo "" - echo "$SCRIPT_NAME - release the specified repository by generating the release yaml file and the release commit" - echo "" + echo "$SCRIPT_NAME - release the docker images for the specified repository by generating the release yaml file and" + echo " the release commit" echo " usage: $SCRIPT_NAME [-options]" echo "" echo " options" diff --git a/integration/src/release_scripts/updateOomImages.sh b/integration/src/release_scripts/updateOomImages.sh index 52459d5d..e5a7d39c 100755 --- a/integration/src/release_scripts/updateOomImages.sh +++ b/integration/src/release_scripts/updateOomImages.sh @@ -26,6 +26,14 @@ SCRIPT_NAME=`basename $0` repo_location="./" release_data_file="./pf_release_data.csv" +# Use the bash internal OSTYPE variable to check for MacOS +if [[ "$OSTYPE" == "darwin"* ]] +then + SED="gsed" +else + SED="sed" +fi + declare -a pf_repos=( "policy/parent" "policy/docker" @@ -154,7 +162,7 @@ do find $repo_location/oom/kubernetes/policy/components \ -name values.yaml \ -exec \ - sed -i \ + $SED -i \ "s/^image:[ |\t]*onap\/$docker_image:[0-9]*\.[0-9]*\.[0-9]*$/image: onap\/$new_image/" {} \; echo "OOM image $docker_image:$latest_released_tag updated" done diff --git a/integration/src/release_scripts/updateParentRef.sh b/integration/src/release_scripts/updateParentRef.sh index 1978e33d..0f10cfbb 100755 --- a/integration/src/release_scripts/updateParentRef.sh +++ b/integration/src/release_scripts/updateParentRef.sh @@ -24,6 +24,14 @@ set -e 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() { echo "" @@ -99,9 +107,9 @@ then exit 1 fi -pom_lines=`wc -l $pom_file | sed 's/^[ \t]*//' | cut -f1 -d' '` -parent_start_line=`grep -n '^[\t ]*<parent>[\t*]*$' $pom_file | cut -f1 -d':'` -parent_end_line=`grep -n '^[\t ]*</parent>[\t*]*$' $pom_file | cut -f1 -d':'` +pom_lines=`wc -l $pom_file | $SED 's/^[ \t]*//' | cut -f1 -d' '` +parent_start_line=`grep -n '^[\t ]*<parent>[\t ]*$' $pom_file | cut -f1 -d':'` +parent_end_line=`grep -n '^[\t ]*</parent>[\t ]*$' $pom_file | cut -f1 -d':'` pom_head_lines=$((parent_start_line-1)) pom_tail_lines=$((pom_lines-parent_end_line)) diff --git a/integration/src/release_scripts/updateRefs.sh b/integration/src/release_scripts/updateRefs.sh index 5a73c58d..ea677487 100755 --- a/integration/src/release_scripts/updateRefs.sh +++ b/integration/src/release_scripts/updateRefs.sh @@ -26,6 +26,14 @@ SCRIPT_NAME=`basename $0` repo_location="./" release_data_file="./pf_release_data.csv" +# Use the bash internal OSTYPE variable to check for MacOS +if [[ "$OSTYPE" == "darwin"* ]] +then + SED="gsed" +else + SED="sed" +fi + usage() { echo "" @@ -203,7 +211,7 @@ then if [ "$update_snapshot" = true ] then echo updating policy parent reference to $parent_latest_snapshot_tag on $repo_location/$target_repo . . . - sed -i \ + $SED -i \ "s/<version.parent.resources>.*<\/version.parent.resources>/<version.parent.resources>$parent_latest_snapshot_tag<\/version.parent.resources>/" \ $repo_location/policy/parent/integration/pom.xml result_code=$? @@ -211,10 +219,9 @@ then next_release_version=${parent_latest_snapshot_tag%-*} echo updating policy parent reference to $next_release_version on $repo_location/$target_repo . . . - echo sed -i \ + $SED -i \ "s/<version.parent.resources>.*<\/version.parent.resources>/<version.parent.resources>$next_release_version<\/version.parent.resources>/" \ - $repo_location/policy/parent/integration/pom.xml - result_code=$? + $repo_location/policy/parent/integration/pom.xml result_code=$? fi else @@ -251,14 +258,14 @@ then if [ "$update_snapshot" = true ] then echo updating policy common reference to $common_latest_snapshot_tag on $repo_location/$target_repo . . . - sed -i \ + $SED -i \ -e "s/<policy.common.version>.*<\/policy.common.version>/<policy.common.version>$common_latest_snapshot_tag<\/policy.common.version>/" \ -e "s/<version.policy.common>.*<\/version.policy.common>/<version.policy.common>$common_latest_snapshot_tag<\/version.policy.common>/" \ $repo_location/$target_repo/pom.xml result_code=$? else echo updating policy common reference to $common_latest_released_tag on $repo_location/$target_repo . . . - sed -i \ + $SED -i \ -e "s/<policy.common.version>.*<\/policy.common.version>/<policy.common.version>$common_latest_released_tag<\/policy.common.version>/" \ -e "s/<version.policy.common>.*<\/version.policy.common>/<version.policy.common>$common_latest_released_tag<\/version.policy.common>/" \ $repo_location/$target_repo/pom.xml @@ -278,14 +285,14 @@ then if [ "$update_snapshot" = true ] then echo updating policy models reference to $models_latest_snapshot_tag on $repo_location/$target_repo . . . - sed -i \ + $SED -i \ -e "s/<policy.models.version>.*<\/policy.models.version>/<policy.models.version>$models_latest_snapshot_tag<\/policy.models.version>/" \ -e "s/<version.policy.models>.*<\/version.policy.models>/<version.policy.models>$models_latest_snapshot_tag<\/version.policy.models>/" \ $repo_location/$target_repo/pom.xml result_code=$? else echo updating policy models reference to $models_latest_released_tag on $repo_location/$target_repo . . . - sed -i \ + $SED -i \ -e "s/<policy.models.version>.*<\/policy.models.version>/<policy.models.version>$models_latest_released_tag<\/policy.models.version>/" \ -e "s/<version.policy.models>.*<\/version.policy.models>/<version.policy.models>$models_latest_released_tag<\/version.policy.models>/" \ $repo_location/$target_repo/pom.xml @@ -305,14 +312,14 @@ then if [ "$update_snapshot" = true ] then echo updating policy drools-pdp reference to $drools_pdp_latest_snapshot_tag on $repo_location/$target_repo . . . - sed -i \ + $SED -i \ -e "s/<policy.drools-pdp.version>.*<\/policy.drools-pdp.version>/<policy.drools-pdp.version>$drools_pdp_latest_snapshot_tag<\/policy.drools-pdp.version>/" \ -e "s/<version.policy.drools-pdp>.*<\/version.policy.drools-pdp>/<version.policy.drools-pdp>$drools_pdp_latest_snapshot_tag<\/version.policy.drools-pdp>/" \ $repo_location/$target_repo/pom.xml result_code=$? else echo updating policy drools-pdp reference to $drools_pdp_latest_released_tag on $repo_location/$target_repo . . . - sed -i \ + $SED -i \ -e "s/<policy.drools-pdp.version>.*<\/policy.drools-pdp.version>/<policy.drools-pdp.version>$drools_pdp_latest_released_tag<\/policy.drools-pdp.version>/" \ -e "s/<version.policy.drools-pdp>.*<\/version.policy.drools-pdp>/<version.policy.drools-pdp>$drools_pdp_latest_released_tag<\/version.policy.drools-pdp>/" \ $repo_location/$target_repo/pom.xml @@ -332,7 +339,7 @@ then echo updating docker base images to version $docker_latest_released_tag on repo $repo_location/$target_repo find $repo_location/$target_repo \ -name '*Docker*' \ - -exec sed -r -i "s/^(FROM onap\/policy-j[d|r][k|e]-alpine:)2.3.1$/\1$docker_latest_released_tag/" {} \; + -exec $SED -r -i "s/^(FROM onap\/policy-j[d|r][k|e]-alpine:)2.3.1$/\1$docker_latest_released_tag/" {} \; result_code=$? if [[ "$result_code" -eq 0 ]] then |