Unix & Linux Stack Exchange is a question and answer site for
users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.
Arithmetic evaluation can be used directly as condition, no need for the [[ ]] to test: while read line; do echo "$line"; ((lines++ % 2)) && echo; done. – manatworkOct 29 '11 at 14:57