aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Holland <samuel.holland@sifive.com>2024-11-11 14:02:47 -0800
committerAnup Patel <anup@brainfault.org>2024-11-28 17:17:54 +0530
commitbb008e5d27069925adf88a6af1e6fdcddf93a36f (patch)
tree77db34109be4b8c79098746561e91ecedcf5ef29
parent1ccc52c427f3f3b2244798cb1895d32a23abe36c (diff)
downloadopensbi-bb008e5d27069925adf88a6af1e6fdcddf93a36f.zip
opensbi-bb008e5d27069925adf88a6af1e6fdcddf93a36f.tar.gz
opensbi-bb008e5d27069925adf88a6af1e6fdcddf93a36f.tar.bz2
scripts/carray.sh: Avoid useless use of cat
awk(1) takes input files as positional arguments, so there is no need to read the file with cat(1). Signed-off-by: Samuel Holland <samuel.holland@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org>
-rwxr-xr-xscripts/carray.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/carray.sh b/scripts/carray.sh
index 7280869..16c6c13 100755
--- a/scripts/carray.sh
+++ b/scripts/carray.sh
@@ -43,19 +43,19 @@ if [ ! -f "${CONFIG_FILE}" ]; then
usage
fi
-TYPE_HEADER=`cat ${CONFIG_FILE} | awk '{ if ($1 == "HEADER:") { printf $2; exit 0; } }'`
+TYPE_HEADER=$(awk '{ if ($1 == "HEADER:") { printf $2; exit 0; } }' "${CONFIG_FILE}")
if [ -z "${TYPE_HEADER}" ]; then
echo "Must specify HEADER: in input config file"
usage
fi
-TYPE_NAME=`cat ${CONFIG_FILE} | awk '{ if ($1 == "TYPE:") { printf $2; for (i=3; i<=NF; i++) printf " %s", $i; exit 0; } }'`
+TYPE_NAME=$(awk '{ if ($1 == "TYPE:") { printf $2; for (i=3; i<=NF; i++) printf " %s", $i; exit 0; } }' "${CONFIG_FILE}")
if [ -z "${TYPE_NAME}" ]; then
echo "Must specify TYPE: in input config file"
usage
fi
-ARRAY_NAME=`cat ${CONFIG_FILE} | awk '{ if ($1 == "NAME:") { printf $2; exit 0; } }'`
+ARRAY_NAME=$(awk '{ if ($1 == "NAME:") { printf $2; exit 0; } }' "${CONFIG_FILE}")
if [ -z "${ARRAY_NAME}" ]; then
echo "Must specify NAME: in input config file"
usage