Resolve shellcheck SC2002 useless cat 22/62822/3
authorThanh Ha <zxiiro@gmail.com>
Wed, 15 Jan 2020 23:47:01 +0000 (18:47 -0500)
committerAnil Belur <abelur@linuxfoundation.org>
Thu, 16 Jan 2020 03:31:05 +0000 (03:31 +0000)
SC2002: Useless cat. Consider 'cmd < file | ..' or
        'cmd file | ..' instead.

Signed-off-by: Thanh Ha <zxiiro@gmail.com>
Change-Id: Icdbeec332969ce5d8769aea1eb325a7fe35bcc77

shell/job-cost.sh
shell/openstack-stack-parameters.sh
shell/release-job.sh

index 2264728..0d0e55e 100644 (file)
@@ -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))
 
index 6302dc4..d6701a4 100644 (file)
@@ -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"
index ccaa782..ee5ab70 100644 (file)
@@ -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#\"}"