[darcs-devel] rollback.sh

Guillaume Outters guillaume.outters at free.fr
Mon Mar 17 22:11:42 UTC 2008


Le 17 mars 2008 à 22:54, David a écrit :

> But alas, my linux machine doesn't have jot.  I see I could install
> the athena-jot package, but it doesn't look like using jot will
> greatly improve our portability.

A placeholder can be included before any seq call; you then  
transparently gain a seq emulation:

command -v seq > /dev/null 2>&1 || seq()
{
	local f=1 l=1 i=1
	[ $# -gt 1 ] && f="$1" && shift
	[ $# -gt 1 ] && i="$1" && shift
	l="$1"
	while [ $f -le $l ]
	do
		echo $f
		true $((f += i))
	done
}

(based on a Linux man page I can access for seq, that is, allowed  
calls are seq end, or seq start end, or seq start increment end)

-- 
Guillaume



More information about the darcs-devel mailing list