Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Help with korn shell
Name: orangepanther Date: December 10, 2003 at 05:36:13 Pacific OS: Unix CPU/Ram: Pentium4 256 MB
Comment:
Hi I'm trying to create a script that generates a random number only one number at a time. I have this RANDOM=12342 while true do echo "$RANDOM" done That generates random numbers but an endless string of them how do I generate only one number?
Name: Jerry Lemieux Date: December 10, 2003 at 06:44:27 Pacific
Reply:
Why not use
print $RANDOM
You don't need to set RANDOM, since it is a system variable. Just get rid of the loop, which is why you are getting a stream of numbers.
0
Response Number 2
Name: Stephen Moss Date: December 14, 2003 at 01:00:37 Pacific
Reply:
If what you are looking for is a random single digit, check "parameter substitution" section of man for ksh, or find good korn shell manual. As an example use the following to generate a single random number from the first position of any number generated by $RANDOM:
Summary: Here it is in Korn shell syntax: integer low high while ! (( low high )) do read low?"Enter a number: " read high?"Enter a higher number: " (( low high )) || print -u2 "No, $...
Summary: Hello! i hope somebody can help me. I would like to have help with an shell script(sh) assignment. I have a file and it contains something like the following text: 02gozal:godam:godhar:TGFGK:halllo ...
Summary: Hi, I am new to korn shell pgming..I need a script to do the following.. Delete all back up directories older than 30 days old directory structure is like this: under main PROCESS dir, I have LOGS1, L...