Article 5T60B [SOLVED] bash script: parameter expansion in {1..$stuff} for example

[SOLVED] bash script: parameter expansion in {1..$stuff} for example

by
ArfaSmif
from LinuxQuestions.org on (#5T60B)
I am using the following in a script

stuff=`dnf history|awk 'NR==3'|cut -d\| -f1|sed -r 's/\s+//g'`

which simply produces a parameter which looks like a number (eg. 580)

I want to use the value of "stuff" as a number in the rest of the script as in:-

for i in {1..$stuff}
do
something else
done

I can't work out how to make $stuff behave as a number and be used the way I
want it in the {1..$stuff} part of the script.

When I print out the value of "i" I get

i={1..580} (the 580 varies depending on the value of stuff.)

How to get this to work? Thanks.latest?d=yIl2AUoC8zA latest?i=aX0qCA50ssY:oszr95TOU_E:F7zBnMy latest?i=aX0qCA50ssY:oszr95TOU_E:V_sGLiP latest?d=qj6IDK7rITs latest?i=aX0qCA50ssY:oszr95TOU_E:gIN9vFw
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