Use `grep -c` instead, as suggested in:
https://github.com/koalaman/shellcheck/wiki/SC2126
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
kdumpctl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl
index 50e92cb4..82010fd7 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -596,7 +596,7 @@ check_rebuild()
#in case of fadump mode, check whether the default/target
#initrd is already built with dump capture capability
if [ "$DEFAULT_DUMP_MODE" == "fadump" ]; then
- capture_capable_initrd=$(lsinitrd -f $DRACUT_MODULES_FILE $TARGET_INITRD | grep -e
^kdumpbase$ -e ^zz-fadumpinit$ | wc -l)
+ capture_capable_initrd=$(lsinitrd -f $DRACUT_MODULES_FILE "$TARGET_INITRD" |
grep -c -e ^kdumpbase$ -e ^zz-fadumpinit$)
fi
fi
--
2.31.1