diff options
author | Simon Nagl <simonnagl@aim.com> | 2016-04-28 22:41:15 +0200 |
---|---|---|
committer | Simon Nagl <simonnagl@aim.com> | 2016-04-29 02:31:15 +0200 |
commit | ec28e63c30962818dab315d64ee4da10005e47fd (patch) | |
tree | e4697d0be4d11c27726366b97351fa378722a3f4 /charts.d/example.chart.sh | |
parent | 444aab651daab58c4e727fffe74ea21bc920cdab (diff) |
Fix #282 use modern arithmetic expansion in shell
Use $((.*)) instead of $[.*]
The later one is old syntax
Diffstat (limited to 'charts.d/example.chart.sh')
-rwxr-xr-x | charts.d/example.chart.sh | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/charts.d/example.chart.sh b/charts.d/example.chart.sh index 34a3bc1bfa..ad20504621 100755 --- a/charts.d/example.chart.sh +++ b/charts.d/example.chart.sh @@ -22,11 +22,11 @@ example_check() { example_create() { # create the chart with 3 dimensions cat <<EOF -CHART example.random '' "Random Numbers Stacked Chart" "% of random numbers" random random stacked $[example_priority] $example_update_every +CHART example.random '' "Random Numbers Stacked Chart" "% of random numbers" random random stacked $((example_priority)) $example_update_every DIMENSION random1 '' percentage-of-absolute-row 1 1 DIMENSION random2 '' percentage-of-absolute-row 1 1 DIMENSION random3 '' percentage-of-absolute-row 1 1 -CHART example.random2 '' "A random number" "random number" random random area $[example_priority + 1] $example_update_every +CHART example.random2 '' "A random number" "random number" random random area $((example_priority + 1)) $example_update_every DIMENSION random '' absolute 1 1 EOF @@ -49,19 +49,19 @@ example_update() { value1=$RANDOM value2=$RANDOM value3=$RANDOM - value4=$[8192 + (RANDOM * 16383 / 32767) ] + value4=$((8192 + (RANDOM * 16383 / 32767) )) if [ $example_count -gt 0 ] then - example_count=$[example_count - 1] + example_count=$((example_count - 1)) - [ $example_last -gt 16383 ] && value4=$[example_last + (RANDOM * ( (32767 - example_last) / 2) / 32767)] - [ $example_last -le 16383 ] && value4=$[example_last - (RANDOM * (example_last / 2) / 32767)] + [ $example_last -gt 16383 ] && value4=$((example_last + (RANDOM * ( (32767 - example_last) / 2) / 32767))) + [ $example_last -le 16383 ] && value4=$((example_last - (RANDOM * (example_last / 2) / 32767))) else - example_count=$[1 + (RANDOM * 5 / 32767) ] + example_count=$((1 + (RANDOM * 5 / 32767) )) - [ $example_last -gt 16383 -a $value4 -gt 16383 ] && value4=$[value4 - 16383] - [ $example_last -le 16383 -a $value4 -lt 16383 ] && value4=$[value4 + 16383] + [ $example_last -gt 16383 -a $value4 -gt 16383 ] && value4=$((value4 - 16383)) + [ $example_last -le 16383 -a $value4 -lt 16383 ] && value4=$((value4 + 16383)) fi example_last=$value4 |