How to generate a random integer with specific range(for example, from 1 to 1000)?
Also, how to convert a floating point number into a integer? (2 Replies)
I want to be able to generate a random number within a korn shell script..
Preferably i would like to be able to state how many digits should be in this random number... ie 4 digits or 5 digits etc
Any ideas? (2 Replies)
I saw this formula to generate random number between two specified values in shell script.the following.
$(((RANDOM%(max-min+divisibleBy))/divisibleBy*divisibleBy+min))
Give a example in book.
Generate random number between 6 and 30.like this.
$(((RANDOM%30/3+1)*3))
But I have a... (1 Reply)
Hi All,
I have extracted some report from database for few activities done.
Now I have a requirement to add some random time(In range of 10-35) in front of each activity.
Can be generated random numbers in any bash/sh shell within a given number range, let's say in between 10-30.
... (10 Replies)
Hi,
i want to check if a variable var1 is not a or b or c
pseudo code:
If NOT (var1 = a or var1 = b or var1 = c)
then
...
fi
I want to use POSIX complaint Korn shell, and for string comparison
For the following code, logical.sh
#!/usr/bin/ksh
var="j"
echo "Var : $var"
if ! { || ||... (12 Replies)
Dear all,
I have a question. I have a txt file say 4000 rows X 1800 Column. I 'd like to creat a new column as the first column which is a column of random numbers (n=4000)
thanks a lot!
Lin (2 Replies)
Hi,
Is anybody experience generate a pair of random number by using awk command?
I wanna to generate a pair of random number (range from 1 to 4124) and repeats it 416 times.
Desired output
2 326
123 1256
341 14
3245 645
.
.
.
I did write the below command:
awk... (5 Replies)
Hi Guys and gals...
As you know I am getting to grips with POSIX and hit this stumbling block.
Generating two random numbers 0 to 255 POSIXly. Speed in not important hence the 'sleep 1' command.
I have done a demo that works, but it sure is ugly! Is there a better way?
#!/bin/sh
# Random... (12 Replies)
Hi all...
This is just a fun project to see if it is possible to get a square root of a positive integer from 1 to 9200000 to 6 decimal places on a 64 bit architecture machine.
It is coded around dash and the results show the values from 0 to 10000.
Complex numbers can easily be catered for by... (3 Replies)
Discussion started by: wisecracker
3 Replies
LEARN ABOUT HPUX
sh
sh(1) General Commands Manual sh(1)NAME
sh - overview of various system shells
SYNOPSIS
POSIX Shell
option] ... string] [arg ...]
option] ... string] [arg ...]
Korn Shell
option] ... string] [arg ...]
option] ... string] [arg ...]
C Shell
[command_file] [argument_list ...]
Key Shell
DESCRIPTION
Remarks
The POSIX .2 standard requires that, on a POSIX-compliant system, executing the command activates the POSIX shell (located in file on HP-UX
systems), and executing the command produces an on-line manual entry that displays the syntax of the POSIX shell command-line.
However, the command has historically been associated with the conventional Bourne shell, which could confuse some users. To meet stan-
dards requirements and also clarify the relationships of the various shells and where they reside on the system, this entry provides com-
mand-line syntax and a brief description of each shell, and lists the names of the manual entries where each shell is described in greater
detail.
The Bourne shell is removed from the system starting with HP-UX 11i Version 1.5. Please use the POSIX shell as an alternative.
Shell Descriptions
The HP-UX operating system supports the following shells:
POSIX-conforming command programming language and command interpreter
residing in file Can execute commands read from a terminal or a file. This shell conforms to current POSIX standards in
effect at the time the HP-UX system release was introduced, and is similar to the Korn shell in many respects. Similar in
many respects to the Korn shell, the POSIX shell contains a history mechanism, supports job control, and provides various
other useful features.
Korn-shell command programming language and commands interpreter
residing in file Can execute commands read from a terminal or a file. This shell, like the POSIX shell, contains a his-
tory mechanism, supports job control, and provides various other useful features.
A command language interpreter
that incorporates a command history buffer, C-language-like syntax, and job control facilities.
Restricted version of the POSIX shell command interpreter.
Sets up a login name and execution environment whose capabilities are more controlled (restricted) than normal user
shells.
restricted version of the Korn-shell command interpreter
Sets up a login name and execution environment whose capabilities are more controlled (restricted) than normal user
shells.
An extension of the standard Korn Shell
that uses hierarchical softkey menus and context-sensitive help.
+--------------+--------------------+
| To obtain: | Use the command: |
+--------------+--------------------+
| POSIX Shell | /usr/bin/sh ... |
| Korn Shell | /usr/bin/ksh ... |
| C Shell | /usr/bin/csh ... |
| Key Shell | /usr/bin/keysh |
+--------------+--------------------+
These shells can also be the default invocation, depending on the entry in the file. See also chsh(1).
WARNINGS
Many manual entries contain descriptions of shell behavior or describe program or application behavior similar to ``the shell'' with a ref-
erence to ``see sh(1)''.
SEE ALSO
For more information on the various individual shells, see:
keysh(1) Key Shell description.
ksh(1) Korn Shell description.
sh-posix(1) POSIX Shell description.
csh(1) C Shell description.
sh(1)