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..b1ca1b13 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 c in $(expand_cpu_list $1); do + cpu_list+="$c " + done + cpu_list_count "$cpu_list" +} + # if str starts with prefix, output remaining part, otherwise output empty string remove_prefix() {