From 9c18e414d756860185cf84ba90a2427dc4a4ab74 Mon Sep 17 00:00:00 2001 From: Thanh Ha Date: Wed, 15 Jan 2020 18:47:01 -0500 Subject: [PATCH] Resolve shellcheck SC2002 useless cat SC2002: Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead. Signed-off-by: Thanh Ha Change-Id: Icdbeec332969ce5d8769aea1eb325a7fe35bcc77 --- shell/job-cost.sh | 2 +- shell/openstack-stack-parameters.sh | 2 +- shell/release-job.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/shell/job-cost.sh b/shell/job-cost.sh index 2264728d..0d0e55ea 100644 --- a/shell/job-cost.sh +++ b/shell/job-cost.sh @@ -39,7 +39,7 @@ else fi # Retrieve the current uptime (in seconds) -uptime=$(cat /proc/uptime | awk '{print $1}') +uptime=$(awk '{print $1}' /proc/uptime) # Convert to integer by truncating fractional part' and round up by one ((uptime=${uptime%\.*}+1)) diff --git a/shell/openstack-stack-parameters.sh b/shell/openstack-stack-parameters.sh index 6302dc48..d6701a41 100644 --- a/shell/openstack-stack-parameters.sh +++ b/shell/openstack-stack-parameters.sh @@ -23,6 +23,6 @@ EOF echo "OpenStack Heat parameters generated" echo "-----------------------------------" echo "parameters:" > "$stack_parameters" -cat "$tmp_params" | sed 's/^/ /' >> "$stack_parameters" +sed 's/^/ /' >> "$stack_parameters" "$tmp_params" cat "$stack_parameters" rm "$tmp_params" diff --git a/shell/release-job.sh b/shell/release-job.sh index ccaa7824..ee5ab70a 100644 --- a/shell/release-job.sh +++ b/shell/release-job.sh @@ -313,8 +313,8 @@ container_release_file(){ local lfn_umbrella lfn_umbrella="$(echo "$GERRIT_URL" | awk -F"." '{print $2}')" - for namequoted in $(cat $release_file | yq '.containers[].name'); do - versionquoted=$(cat $release_file | yq ".containers[] |select(.name==$namequoted) |.version") + for namequoted in $(yq '.containers[].name' $release_file); do + versionquoted=$(yq ".containers[] |select(.name==$namequoted) |.version" $release_file) #Remove extra yaml quotes name="${namequoted#\"}" -- 2.16.6