kdump option space checking improvement

We can use not only space but also tab as whitespace,
so s/\ /[[:blank:]] for checking the whitespace

The last commit is intend for checking multiple dump target,
and differentiate ssh and sshkey options. This issue is only
for ssh, so no need to add [[:blank:]] for other dump types to
create a very long code line.

[v1->v2]: use [[:blank:]] instead of [[:space:]]
see expanation in below doc:
http://en.wikipedia.org/wiki/Regular_expression#POSIX_character_classes
[:blank:] 	[ \t] 	Space and tab
[:space:]	[ \t\r\n\v\f] 	Whitespace characters

Tested the [:blank:] works well as [:space:]

Signed-off-by: Dave Young <dyoung@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
CC: Cong Wang <amwang@redhat.com>
This commit is contained in:
Dave Young 2012-11-14 13:56:50 +08:00
parent d17cf94ea9
commit f3914a98a6
2 changed files with 2 additions and 2 deletions

View File

@ -115,7 +115,7 @@ dump_ssh()
is_ssh_dump_target()
{
grep -q "^ssh.*@" $conf_file
grep -q "^ssh[[:blank:]].*@" $conf_file
}
is_raw_dump_target()

View File

@ -364,7 +364,7 @@ function save_raw()
function start()
{
local nr
nr=$(awk 'BEGIN{cnt=0} /^raw |^ssh |^nfs |^ext[234] |^xfs |^btrfs |^minix /{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE)
nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE)
[ $nr -gt 1 ] && {
echo -n "Error: More than one dump targets specified"; echo
return 1