[NTLUG:Discuss] Bash script question

Lance Simmons lance at lsimmons.net
Wed Jan 19 16:22:57 CST 2005


* Chris Cox <cjcox at acm.org> [050119 15:19]:
> 
> Off the top of my head (this is bash)
> 
> file="$1"
> # Cheep seeding (good enough?)
> RANDOM=$(expr $(date +%d%S%M%S) % 32767)
> for (( i=1; i <= 40; i++)); do
> 	s=$(expr $RANDOM % 100)
> 	sed -n "${s}p" $file
> done

A noticeable percentage of the time, sed chokes on line address 0.

-- 
Lance Simmons
Culture survives and develops under the aegis of permanence.  Instantaneity --
the enemy of permanence -- is one of the chief imperatives of our time. It
renders anything lasting, anything inherited, suspicious by definition.
		-- Roger Kimball



More information about the Discuss mailing list