I do this:
VAL=$(wc -l < file_with_5_lines)
for i in {1..${VAL}}; do echo $i; done
Expecting this result:
1
2
3
4
5
Instead of that I get this one:
{1..5}
EDIT
This question was marked as duplicate but the accepted answer for the other question isn't valid in my opinion. The proposed solution is this:
VAL=$(wc -l < file_with_5_lines)
for i in {1..$((VAL))}; do
echo $i
done
And continues to give me this result:
{1..5}
Instead of:
1
2
3
4
5