$RANDOM is a BASH defined variable. Rewrite the randomize() function to be POSIX-compliant.
Signed-off-by: Lisa Nguyen <lisa.ngu...@linaro.org> --- cpuhotplug/cpuhotplug_08.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cpuhotplug/cpuhotplug_08.sh b/cpuhotplug/cpuhotplug_08.sh index 43948cf..de4fea8 100755 --- a/cpuhotplug/cpuhotplug_08.sh +++ b/cpuhotplug/cpuhotplug_08.sh @@ -27,12 +27,15 @@ . ../include/functions.sh -function randomize() { +randomize() { + random=$(od -A n -N 2 -t u2 /dev/urandom) + number=$(echo $random % $1) + if [ $hotplug_allow_cpu0 -eq 0 ]; then - echo $[ ( $RANDOM % $1 ) + 1 ] - else - echo $[ ( $RANDOM % $1 ) ] + number=$(($number + 1)) fi + + echo $number } random_stress() { -- 1.7.9.5 _______________________________________________ linaro-dev mailing list linaro-dev@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-dev