1 year ago

#371396

test-img

Milky

Why won't incrementing work with this bash shell script?

I am trying to make a user input increment however, if I tried a variable in the increment, it does not work. How to make it work?

My script:

#!/bin/bash
input=$(echo "$((2*100))")
for a in {100..$input..100}
#for a in {100..500..100}
do
    echo "Increment at $a times"
done

this will return:

"Increment at {100..200..100} times"

Will appreciate any help. Thank you!

bash

shell

increment

0 Answers

Your Answer

Accepted video resources