Hi Kairui,
On Thu, 12 Aug 2021 13:47:36 +0800
Kairui Song <kasong(a)redhat.com> wrote:
Some `cat` calls are useless, remove them to make it cleaner.
add a reference to
https://github.com/koalaman/shellcheck/wiki/SC2002 ?
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
dracut-module-setup.sh | 6 ++++--
kdumpctl | 22 ++++++++++++----------
mkdumprd | 2 +-
3 files changed, 17 insertions(+), 13 deletions(-)
[...]
diff --git a/kdumpctl b/kdumpctl
index a4c257be..904f4bb7 100755
--- a/kdumpctl
+++ b/kdumpctl
[...]
@@ -832,8 +831,11 @@ propagate_ssh_key()
show_reserved_mem()
{
- local mem=$(cat /sys/kernel/kexec_crash_size)
- local mem_mb=$(expr $mem / 1024 / 1024)
+ local mem
+ local mem_mb
+
+ mem=$(</sys/kernel/kexec_crash_size)
+ mem_mb=$(expr "$mem" / 1024 / 1024)
Not actually part of the patch but the mem_mb variable is superfluous.
[...]
diff --git a/mkdumprd b/mkdumprd
index de4e9944..60c2fa05 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -331,7 +331,7 @@ is_unresettable()
if [ -f "$path" ]
then
- resettable="$(cat $path)"
+ resettable="$(<path)"
^^^^
$path !
Thanks
Philipp
[ $resettable -eq 0 -a "$OVERRIDE_RESETTABLE" -eq
0 ] && {
local device=$(udevadm info --query=all --path=/sys/dev/block/$1 | awk -F=
'/DEVNAME/{print $2}')
derror "Error: Can not save vmcore because device $device is
unresettable"