On 10/20/14 at 12:56pm, WANG Chao wrote:
get_option_value() is used to get the value of $1 configured in
/etc/kdump.conf. But when we use "get_option_value ssh", it can get the
value of "sshkey" instead of "ssh".
Fix it by adding "-w" option to grep to get the match for the exact
word.
Seems it will print the line with '-', who knows if we will add option with
such character or not in the future...
bash-4.2$ cat kdump.conf
ssh-key
bash-4.2$ grep -w ^ssh kdump.conf
ssh-key
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
---
kdump-lib.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index a20c6e8..df080e5 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -109,7 +109,7 @@ get_mntpoint_from_target()
# get_option_value <option_name>
# retrieves value of option defined in kdump.conf
get_option_value() {
- echo $(strip_comments `grep ^$1 /etc/kdump.conf | tail -1 | cut -d\ -f2-`)
+ echo $(strip_comments `grep -w ^$1 /etc/kdump.conf | tail -1 | cut -d\ -f2-`)
}
#This function compose a absolute path with the mount
--
1.9.3
_______________________________________________
kexec mailing list
kexec(a)lists.fedoraproject.org
https://lists.fedoraproject.org/mailman/listinfo/kexec