I have gone through various sources but could not able to understand how to implement such as Bash - propagate value of variable to outside of the loop.
I have Array which contains string and each string is use for making directories. Inside the loop everything is going fine but outside the loop the value is lost. i mean echo $b is not printing. here is my code
#!/bin/bash
#skipped portion of code
#......
#......
b=$(mkdir fff)
Array[0]="the"
Array[1]="world"
for i in "${!Array[@]}"
do
echo $i
b="$(mkdir -p "$b/$v")"
done <<< "$b"
echo "$b" // does not printing