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: "Eric O. Flores" <goripi@example.com>
- Date: Fri, 8 Mar 2002 15:54:43 +0900
- Content-transfer-encoding: 8bit
- Content-type: text/plain; charset="iso-2022-jp"
- In-reply-to: <E28C7455D269404DA000E44C215D25C728621F@example.com>
- References: <E28C7455D269404DA000E44C215D25C728621F@example.com>
Thank you Paul and thank you all for the instructional code and comments definitively makes our learning experience here one to remember. I will copy the script and worked into the kmail command and let you know the end result. Do you need the files wave files? 金曜日 08 3月 2002 09:58、Paul Richter さんは書きました: > OK, I wrote a bash script that will print one randomly chosen line from a > specified file. > > Eric wanted Kmail to play a randomly picked soundfile every time a mail > arrived. So, if there's a text file listing all the sound files to choose > from (filelist.txt), you could call this script 'randline' and do > > >$ artsplay `randline filelist.txt` > > ---------------------------------------- > #!/bin/bash > #prints one randomly chosen line from a specified file > > INFILE=$1 > > #all that piping is because wc -l prints formatted output instead > # just a single number > LINECOUNT=`wc -l $INFILE | tr -s ' ' | cut -d ' ' -f 2` > > # RANDOM returns 0 - 32767, so normalize it to 1 - LINECOUNT > let LINENUM=(1+($RANDOM%$LINECOUNT)) > > head -n $LINENUM $INFILE | tail -n 1 > # end of script > ---------------------------------------- > > Paul Richter > RichterPN@example.com
- Follow-Ups:
- [tlug] orinoco
- From: Mario Luoni
- References:
- RE: [tlug] random in bash [Kmail Notification]
- From: Paul Richter
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] Help! - I broke dhcp
- Next by Date: [tlug] orinoco
- Previous by thread: RE: [tlug] random in bash [Kmail Notification]
- Next by thread: [tlug] orinoco
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links