[PATCH v2 lkp-tests] common.sh: add function for count input cpu number

20 Nov
2020
20 Nov
'20
10:11 a.m.
Signed-off-by: Wei Jihui <weijihuiall@163.com> --- lib/common.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/common.sh b/lib/common.sh index 2a93aafa..95d7953c 100755 --- a/lib/common.sh +++ b/lib/common.sh @@ -85,6 +85,18 @@ cpu_list_ref() echo $cpu_list | cut -d ' ' -f $((n+1)) } + +# input: 1-3 output: 3 +# input: 1,3 output: 2 +cpu_list_num() +{ + cpu_list="" + for cpu in $(expand_cpu_list $1); do + cpu_list+="$cpu " + done + cpu_list_count "$cpu_list" +} + # if str starts with prefix, output remaining part, otherwise output empty string remove_prefix() { -- 2.23.0
1560
Age (days ago)
1560
Last active (days ago)
0 comments
1 participants
participants (1)
-
Wei Jihui