I have 15 paths stored in a array variable, and file names, also stored as another array variable and I want to bind each path to its corresponding file. I was looking for sth that will bind each path element with its corresponding file like this:
ar1=([1]="path1" [2]="path2")
ar2=([1]="file1" [2]="file2")
and I need:
ar3=([1]="path1/file1" [2]="path2/file2")
I successfully managed w/ a simple for-loop:
for i in {1..2}; do
ar3=("${ar1[$i]}""/""${ar1[$i]}"".txt")
done
but I need the variable ar3
for further parts of the script and I cannot use it outside the for-loop sub-shell.
Thanks a lot, Guy