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
Try the seq
command
cmd=( $(seq 1 1000) )
If you are running bash you may take advantage of its features.
Try:
cmd=({1..1000})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With