[NTLUG:Discuss] Bash script question
Chris Cox
cjcox at acm.org
Wed Jan 19 17:25:09 CST 2005
Lance Simmons wrote:
> * 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.
>
hee hee... just add one I guess... hey... it was
off of the top of my head (the way buffer overflows
and such are born!)
s=$(expr $s + 1)
More information about the Discuss
mailing list