Increment the elements of an array by 1 (1 thru 1000)

Viewed 1350

I ma still a ROOKIE when it comes to shell script. Long story short I am trying the increment the values of the array by one for every iteration. Here is my code

cmd=(1 2 3 4 5 6 7 8 ................)  // How can I pass numbers 1 to 1000 with out having to type manually.
${cmd[@]}

for (( i = 0 ; i < ${#cmd[@]} ; i++ )) do
echo ${cmd[$i]}"

done  

One approach would be cmd=() and then inside the loop we add the line "let cmd[i]++" , but it didnt work for me. Thanks in advance

3 Answers
Related