Article 509F1 [SOLVED] nested for loop

[SOLVED] nested for loop

by
Drosera_capensis
from LinuxQuestions.org on (#509F1)
Hello everyone,

I have a little issue with a nested for loop, and I don't understand what is not working in.

I try to output the following files:

title_one_1.txt
title_one_2.txt
title_one_3.txt
title_two_1.txt
title_two_2.txt
title_two_3.txt
title_three_1.txt
title_three_2.txt
title_three_3.txt

Therefore, I set up a nested for loop to output this list.

array="one two three"
for f in $array
do
for p in {1..3} ;
do
echo title_$f_$p.txt
done ;
done

But it is not working. It seems that variables as $f are not processed with underscores, but with dots.
Would anyone know how to output the list above?latest?d=yIl2AUoC8zA latest?i=ZCX89zoczvc:u5rvhdSQq_c:F7zBnMy latest?i=ZCX89zoczvc:u5rvhdSQq_c:V_sGLiP latest?d=qj6IDK7rITs latest?i=ZCX89zoczvc:u5rvhdSQq_c:gIN9vFwZCX89zoczvc
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments