Q: count inside a loop
hello
i am trying to write a for-loop that doesn't start from 1, but the loop count start from 1 Code:
for (( i=$a; i <= $b; i++ )); do echo "$x:$i"; done i want the result be like this: Quote:
|
If I understand well..
Code:
#!/bin/bash |
Or even simpler:
Code:
bash-4.2$ for i in $(seq 1 11); do printf '%d: %d\n' "$i" "$(($i + 9))"; done |
thanks kooru,
Quote:
|
This is a simple way
Code:
for (( x=1,i=10 ; x <= 10, i<=20; x++, i++)) |
Quote:
thanks again :hattip: |
No worries; glad to help :)
|
All times are GMT -5. The time now is 02:07 AM. |