Mailing List ArchiveSupport open source code!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] random in bash [Kmail Notification]
- To: tlug@example.com
- Subject: Re: [tlug] random in bash [Kmail Notification]
- From: Shimpei Yamashita <shimpei@example.com>
- Date: Thu, 7 Mar 2002 22:42:35 +0900
- Content-disposition: inline
- Content-type: text/plain; charset=us-ascii
- In-reply-to: <20020307191533.1c3c0549.s45652001@example.com>
- Organization: Hummingbird Heaven
- References: <200203040828.g248Sut02499@example.com> <200203070714.g277Ebl02607@example.com> <200203070948.g279mMt08364@example.com> <200203070953.g279rxl18481@example.com> <20020307191533.1c3c0549.s45652001@example.com>
- Sender: Shimpei Yamashita <shimpei@example.com>
- User-agent: Mutt/1.3.27i
On Thu, Mar 07, 2002 at 07:15:33PM +0900, Antony Stace wrote: > > > > Do anyone know how to do a "random" in bash ? I guess that would be the > > simpliest way to do that. > > very crude....but > > function rand > { > TMPFILE=/tmp/BASHRANDOMTMPFILE.$$ > /usr/bin/vmstat > $TMPFILE > /usr/bin/uptime >> $TMPFILE > /usr/bin/free >> $TMPFILE > /sbin/ifconfig >> $TMPFILE > /bin/date >> $TMPFILE > cksum $TMPFILE | awk '{print $1}' > \rm $TMPFILE > } Well, if you're going to be platform dependent, you might as well use the kernel random number generator. function rand { perl -e 'open IN,"/dev/random" or die $!;sysread(IN,$r,4);print unpack("L",$r)' } The C equivalent is almost as short. -- Shimpei Yamashita http://www.shimpei.org/ You can't have everything. Where would you put it? -- Steve Wright
- Follow-Ups:
- Re: [tlug] random in bash [Kmail Notification]
- From: Tod McQuillin
- References:
- [tlug] Kmail Notification
- From: Eric O. Flores
- Re: [tlug] Kmail Notification
- From: Erwan Loisant
- Re: [tlug] Kmail Notification
- From: Eric O. Flores
- [tlug] random in bash [Kmail Notification]
- From: Erwan Loisant
- Re: [tlug] random in bash [Kmail Notification]
- From: Antony Stace
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] RH7.2
- Next by Date: Re: [tlug] random in bash [Kmail Notification]
- Previous by thread: Re: [tlug] random in bash [Kmail Notification]
- Next by thread: Re: [tlug] random in bash [Kmail Notification]
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links