In a bash script, I don’t remember how to use the value of a variable as a substring of a folder name. Example:
I have folders:
test_1.0_xxx test_1.2_yyy test_1.4_zzz
And I want to do the following:
for i in 1.0 1.2 1.4
do
cd test_$i_*
# do something
done
The syntax seems to be wrong:
bash: cd: test_*: No such file or directory
I also tried using backticks around $i, but with no success. How should I do it?
Try with this: