04-01-2008
$random
I need to use the $RANDOM command to get a line from a list of lines in a file randomly.
file is
help
go
three
house
film
how do i randomly get one word without looking into the file?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello, I am very new to shell scripting. This problem seems quite easy so it should be quite easy (I hope ^^)
I want to get a random file from a directory. this file will be in one subdirectory, and it will contain spaces.
code I have got so far:
N=find ./*/*.jpg | wc -l
((N=RANDOM%N))
... (6 Replies)
Discussion started by: davidY
6 Replies
2. Shell Programming and Scripting
My problem is as follow and i hope you can help:
I currently have this function:
stored_word()
{
number=$RANDOM
let "number %= 21"
case $number in
0 ) echo "energy" ;; 1 ) echo "touch" ;;
2 ) echo "climbing" ;; 3 ) echo "declare" ;;
4 ) echo "marry" ;; 5 ) echo "relax" ... (8 Replies)
Discussion started by: keyvan
8 Replies
3. UNIX for Dummies Questions & Answers
Hi there folks,
for an exercise for my pupils (you know i am always thinking of them!) i need to randomly re-arrange the words (blank space separated) in a sentence (a line in a textfile). Any inspiration??
Txk so much. (9 Replies)
Discussion started by: eldeingles
9 Replies
4. Ubuntu
Hi
I am new to expect. Please if any one can help on my issue its really appreciable. here is my issue:
I want expect script for random passwords and random commands generation.
please can anyone help me?
Many Thanks in advance (0 Replies)
Discussion started by: vanid
0 Replies
5. Programming
How can I choose randomly the row numbers of my file in awk? (4 Replies)
Discussion started by: Homa
4 Replies
6. UNIX for Dummies Questions & Answers
Over the last month or so my CentOS server has been crashing for reasons I do not know. It has been running for over a year with regular yum updates without problems. The load on the server is perfectly normal with CPU usage at 5-6% and RAM usage at less than half of 32GB of RAM (multiple smaller... (3 Replies)
Discussion started by: spinner0205
3 Replies
7. Shell Programming and Scripting
1
2
4
5
3
I would like to use a script so that i can randomly rearrange these numbers such as
3
5
2
4
1
Thanks! (3 Replies)
Discussion started by: johnkim0806
3 Replies
8. Shell Programming and Scripting
Hi,
Could you please let me know what the following code does, I know that it means generating random numbers, however not sure what is the entire purpose.
R=$(($RANDOM % 2))
delay=$(($RANDOM % 10))
if
then
TEXT='X'
else
... (3 Replies)
Discussion started by: susankoperna1
3 Replies
9. Shell Programming and Scripting
Need to use dd to generate a large file from a sample file of random data. This is because I don't have /dev/urandom.
I create a named pipe then:
dd if=mynamed.fifo do=myfile.fifo bs=1024 count=1024
but when I cat a file to the fifo that's 1024 random bytes:
cat randomfile.txt >... (7 Replies)
Discussion started by: Devyn
7 Replies
10. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
Write a shell script that will take the sum of two random number?
Ex: Random n1 +Random n2 = result
i tries to write it but i had some dufficulties
... (3 Replies)
Discussion started by: renegade755
3 Replies
PMSD(8) System Manager's Manual PMSD(8)
NAME
pmsd - Periodically Manic System Daemon. Manages the bizzare and sometimes unexplainable behavior exhibited by computers.
SYNOPSIS
pmsd [-bcfmp]
DESCRIPTION
pmsd is a rogue daemon that is spawned on a semi-regular schedule by init(8). Most of the unusual and quirky behavior associated with mis-
behaving computers can be attributed to pmsd.
pmsd has a number of command-line options, invoked at run-time by init(8). The ps(1) command will occasionally display the current
options, but only if pmsd feels like revealing them. This is usually not the case. pmsd can be manually invoked by the pms(8) command. Make
sure there is not a pmsd process already running when you use pms(8); you don't want to be on a system with multiple instances of pmsd run-
ning.
With no flags, pmsd runs with the default -m option, and any others it feels like using.
OPTIONS
-b Bloat. Files randomly grow in size, filling up filesystems and causing quotas to be exceeded.
-c Craving. System becomes hungry, eating magnetic tapes, CD-ROM discs, floppies, and anything else a hapless user loads into a remov-
able media drive.
-f Fatigue. System will pause for a random period of time. It is important to leave the system alone during this time. Attempts to coax
the machine into normal operation could cause the spontaneous activation of all command-line switches. This is to be avoided.
-m Mood swings. Process priorities and nice values are altered randomly. Swapping usually occurs with no warning, even when memory is
available. This is the default behavior.
-p Peeved. One or more users are selected as targets of the system's anger. Files are deleted, e-mail copied to /etc/motd, and any
Usenet articles posted by the targets are crossposted to misc.test and alt.flame.
NOTES
When pmsd is invoked by using the pms(8) command, pmsd ignores any command-line switches and does what it damned well pleases.
SEE ALSO
pms(8)
BUGS
There are no bugs; how could you ask that?
HISTORY
Written by Eric L. Pederson <eric@bofh.org.uk>.
25 March 1996 PMSD(8)