From 37b61ee43a71b981f774f161caecedf62b96ae28 Mon Sep 17 00:00:00 2001 From: Tao Liu Date: Nov 03 2021 08:13:28 +0000 Subject: dracut-module-setup.sh: rework kdump_get_ip_route_field upstream: fedora resolves: bz2003832 conflict: none commit 46542ccda5df42a8b07e1d7fee629374e51e732a Author: Kairui Song Date: Wed Aug 4 02:59:43 2021 +0800 dracut-module-setup.sh: rework kdump_get_ip_route_field Avoid duplicated echo / cut / grep call, just use sed. Signed-off-by: Kairui Song Acked-by: Philipp Rudo Signed-off-by: Tao Liu --- diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 0779224..a49107d 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -520,9 +520,7 @@ kdump_get_ip_route() kdump_get_ip_route_field() { - if `echo $1 | grep -q $2`; then - echo ${1##*$2} | cut -d ' ' -f1 - fi + echo "$1" | sed -n -e "s/^.*\<$2\>\s\+\(\S\+\).*$/\1/p" } kdump_get_remote_ip()