I have a bash script to control Linux perf. As you may know, perf takes core list which can be specified in 1 of the three ways.
- -C1 #core 1 only
- -C1-4 # core 1 through 4
- -C1,3 # core 1 and 3
Currently, I have an environment variable CORENO which will control -C$CORENO.
However, I need to offset CORENO by a fix offset (I.e.2)
I could do ((CORENO+=2)) but that only work for case 1.
Is there a Linux/bash trick to allow me to apply fix offset to every number in a bash variable?