0

I have a script.sh

#!/bin/bash
for i in {1..$1}
do
    echo $i
done

someone could explain me why if I try ./script.sh 10 my output is {1..10}? expected 1 2 ... 10

h3xxx
  • 1
  • 1

1 Answers1

0

You're echoing the parameter that you're passing in instead of printing out the loop iteration. Try:

echo $i

Scott
  • 232
  • 1
  • 10