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:
parent
d17cf94ea9
commit
f3914a98a6
@ -115,7 +115,7 @@ dump_ssh()
|
|||||||
|
|
||||||
is_ssh_dump_target()
|
is_ssh_dump_target()
|
||||||
{
|
{
|
||||||
grep -q "^ssh.*@" $conf_file
|
grep -q "^ssh[[:blank:]].*@" $conf_file
|
||||||
}
|
}
|
||||||
|
|
||||||
is_raw_dump_target()
|
is_raw_dump_target()
|
||||||
|
2
kdumpctl
2
kdumpctl
@ -364,7 +364,7 @@ function save_raw()
|
|||||||
function start()
|
function start()
|
||||||
{
|
{
|
||||||
local nr
|
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 ] && {
|
[ $nr -gt 1 ] && {
|
||||||
echo -n "Error: More than one dump targets specified"; echo
|
echo -n "Error: More than one dump targets specified"; echo
|
||||||
return 1
|
return 1
|
||||||
|
Loading…
Reference in New Issue
Block a user