I have a list of data that the user gives as arguments.
For simplicity-sake of the code that comes after the one shown, this code builds a relationship between the value inputted and the position it was inputted.
values=("${@:2}")
values2=()
for i in ${!values[@]}; do values2[${values[$i]}]="$i" echo "$values2"
done
echo $values2This code worked in ubuntu 16.04 but doesn't work on ubuntu 18.04. I don't know what I'm missing.
In this code, no errors appear and, instead, at the end of this code snippet, the variable values2 is always empty.
If I call this code using thisscript param1 1600 2000 3000, after that for, which is ran, $values2 stays empty.
What is deleting $values2?