[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Vote: Should $PARALLEL_PID {#} count from 0 or 1
From: |
Hans Schou |
Subject: |
Re: Vote: Should $PARALLEL_PID {#} count from 0 or 1 |
Date: |
Thu, 14 Apr 2011 20:34:14 +0200 (CEST) |
User-agent: |
Alpine 2.00 (DEB 1167 2008-08-23) |
On Thu, 14 Apr 2011, Jay Hacker wrote:
I vote for 0:
* Arrays in most programming languages start at 0
Yes, but not shells
* Unix tools that produce multiple files start at 0: split, csplit,
not head, tail and cut. A usefull example:
cat /var/log/messages | cut -c1-$COLUMNS
* Integer division of N things numbered 0..N-1 by N maps consecutive
items the same group; 1..N does not
* Integer remainder of N things numbered 0..N-1 mod N gives nice,
ordered round-robin groups; 1..N does not
* Most clusters name their machines node000-nodeXXX
* Having to escape $(( {#} - 1 )) in Bash is not pretty
Can you give an example where this is used with parallel?
/hans
--
Horsebakken 78, DK-2400 København NV