I would like to take the user's input and decrement each value taken in by one. For example, if the user provides:
0 1 6 8
I would like to change this to:
-1 0 5 7
My code looks like this, but doesn't seem to work:
echo 'Please enter numbers:'
read numbers
IFS=' '
numarray=($numbers)
for i in "${numarry[@]}"
do
(( numarray[i]-- ))
done
echo ${numarray[@]}
But the code doesnt seem to work. Any ideas? Thanks for your help.