If you are using bash and trying to do anything like this
always enclose your variable name with {} so that bash knows what variable you are talking about.
If you use ${f} instead of $f you'll find it should work as you expect.
Without {} bash is actually looking for a variable
$f_ in your example rather than just $f
So:
Code:
array="one two three"
for f in $array ; do
for p in {1..3} ; do
echo title_${f}_${p}.txt
done
done