Sponsored Content
Full Discussion: Random
Top Forums Shell Programming and Scripting Random Post 302118789 by anbu23 on Thursday 24th of May 2007 08:19:34 AM
Old 05-24-2007
Code:
number=$(( RANDOM % 21 + 1 ))
word=$( sed -n "$number p" words_list_file )
letters=$(echo $word | wc -c)
letters=$(( $letters - 1 ))
template="$(echo $word | tr '[a-z A-Z 0-9]' '.')"
remaining=$letters

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Getting a random file

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

$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? (6 Replies)
Discussion started by: relle
6 Replies

3. UNIX for Dummies Questions & Answers

random words

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

expect script for random password and random commands

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

random number

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

Random Crashing

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

Random ordering

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

Random Variable

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 generate a file with random data. /dev/[u]random doesn't exist.

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

Random numbers

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
CTYPE_LOWER(3)								 1							    CTYPE_LOWER(3)

ctype_lower - Check for lowercase character(s)

SYNOPSIS
bool ctype_lower (string $text) DESCRIPTION
Checks if all of the characters in the provided string, $text, are lowercase letters. PARAMETERS
o $text - The tested string. RETURN VALUES
Returns TRUE if every character in $text is a lowercase letter in the current locale. EXAMPLES
Example #1 A ctype_lower(3) example (using the default locale) <?php $strings = array('aac123', 'qiutoas', 'QASsdks'); foreach ($strings as $testcase) { if (ctype_lower($testcase)) { echo "The string $testcase consists of all lowercase letters. "; } else { echo "The string $testcase does not consist of all lowercase letters. "; } } ?> The above example will output: The string aac123 does not consist of all lowercase letters. The string qiutoas consists of all lowercase letters. The string QASsdks does not consist of all lowercase letters. NOTES
Note If an integer between -128 and 255 inclusive is provided, it is interpreted as the ASCII value of a single character (negative val- ues have 256 added in order to allow characters in the Extended ASCII range). Any other integer is interpreted as a string contain- ing the decimal digits of the integer. SEE ALSO
ctype_alpha(3), ctype_upper(3), setlocale(3). PHP Documentation Group CTYPE_LOWER(3)
All times are GMT -4. The time now is 10:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy