
On Thu, Nov 19, 2020 at 09:25:59PM +0800, Wei Jihui wrote:
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 ^ unclear variable
How about 'cpu', is means each cpu from expand_cpu_list.
+ cpu_list+="$c "
ditto. Thanks, Chenglong
+ done + cpu_list_count "$cpu_list" +} + # if str starts with prefix, output remaining part, otherwise output empty string remove_prefix() { -- 2.23.0