I need to setup an array and use that to loop through and list the files. I started with this setup and it works.
file = (x1 x2 x3 x4 x5)
for var in ${file[@]}; do
echo $var
done
I have a requirement to add the timestamp on these variables, I tried a few ways and none of the seem to work. Here is one way I tried to define the array:
today=$(date +"%Y%m%d")
file = (x1_"$today" x2_"$today" x3_"$today" x4_"$today" x5_"$today")
What would be the best way to define the array, where the array element has a variable?