Sponsored Content
Top Forums Shell Programming and Scripting Parsing a command line parameter in script Post 302548142 by pbmax626 on Wednesday 17th of August 2011 02:23:18 PM
Old 08-17-2011
Well, the & was the cause of the error, apparently. However, changing that did not produce the desired result. What do you recommend as step 2?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Command Line width parameter

can someone please tell me how i can increase the number of characters that can be input on the command line? (2 Replies)
Discussion started by: Scoogie
2 Replies

2. Programming

Command line parameter for C program

I am writing a C program that part of the idea is to using a command line parameter to control not to run certain part of the sub program. I am totally new to C, I do not have any idea how to pass a command line arguments from a C program. Can anyone help ?! Thanks (3 Replies)
Discussion started by: Wing m. Cheng
3 Replies

3. Shell Programming and Scripting

using tab to finish command line parameter

Anyone know how to set it up so that when at command line in unix (specifically solaris 2.5.1), and you hit the tab it will finish the command with the nearest file that matches? AND how to set it up so using up and down arrows access your previous commands? Thanks for all the help here, i've had... (3 Replies)
Discussion started by: kymberm
3 Replies

4. Shell Programming and Scripting

replacing a string in a file with command line parameter

Hello, I am trying to replace a string with a paramter given along with the script. I am replacing application1 to application2 with the script: ./change_app.sh application2 change_app.sh: #!/bin/ksh grep $1 applications.dat 2>&1 >/dev/null echo $1 file=pckage.new sed 's/Name:... (5 Replies)
Discussion started by: chiru_h
5 Replies

5. Shell Programming and Scripting

Using the counter of a for loop in command line parameter

Say I have (in psuedocode) For i=1 to 10 tar cvfb /... 5*i /junk(i) end What I mean is that I want each successive for loop to have the block size parameter be 5 times the current counter. This isn't my actual code, just a stupid example...So the question is how do I descrive that parameter... (2 Replies)
Discussion started by: jeriryan87
2 Replies

6. Shell Programming and Scripting

How to compare a command line parameter with -- in shell scripting

Hi, I need to check if a parameter provided at the command line is equal to --.How can i do that ? Please help me. Thanks and Regards, Padmini (4 Replies)
Discussion started by: padmisri
4 Replies

7. Shell Programming and Scripting

How to get the last command line parameter?

"$#" gives the number of command-line arguments. How do you get the last command-line parameter (or any particular one determined by a variable)? I thought it would be "${$#}", but that produces something completely unexpected. (4 Replies)
Discussion started by: dkarr
4 Replies

8. Shell Programming and Scripting

perl script - command line parameter

i am a beginner, i want to make a program that takes any command line arguments... and print it out in reverse. ie. if the command line argument is "thanks for helping me" i want it to output "me helping for thanks" :D i have tried using the reverse command, but i cant get it working!! ... (3 Replies)
Discussion started by: bshell_1214
3 Replies

9. UNIX and Linux Applications

Passing date parameter on Kshell command line

I need to execute a .ksh from command line. The ksh calls a control file and has 3 parameters. First parameter is a csv file, second the target table in oracle and third parameter is a date parameter. I am attempting the below from the ksh command line {code} => testfile.ksh filname.csv... (1 Reply)
Discussion started by: kobe24
1 Replies

10. Shell Programming and Scripting

Parsing Command Line Arguments In C shell script

]I have a string like "/abc/cmind/def/pq/IC.2.4.6_main.64b/lnx86" and this string is given by user. But in this string instead of 64b user may passed 32 b an i need to parse this string and check wether its is 32b or 64 b and according to it i want to set appropriate flags. How will i do this... (11 Replies)
Discussion started by: codecatcher
11 Replies
random(3)						     Library Functions Manual							 random(3)

Name
       random, srandom, initstate, setstate - better random number generator; routines for changing generators

Syntax
       long random()

       void srandom(seed)
       int seed;

       char *initstate(seed, state, n)
       unsigned seed;
       char *state;
       int n;

       char *setstate(state)
       char *state;

Description
       The  subroutine	uses  a  non-linear additive feedback random number generator employing a default table of size 31 long integers to return
       successive pseudo-random numbers in the range from 0 to (2**31)-1.  The period of this random number generator is very large, approximately
       16*((2**31)-1).

       The  subroutines  have  (almost)  the same calling sequence and initialization properties as The difference is that rand(3) produces a much
       less random sequence - in fact, the low dozen bits generated by rand go through a cyclic pattern.  All the bits generated  by  are  usable.
       For example, "random()&01" will produce a random binary value.

       Unlike  does  not  return  the  old seed; the reason for this is that the amount of state information used is much more than a single word.
       (Two other routines are provided to deal with restarting/changing random number generators.)  Like  however,  will  by  default	produce  a
       sequence of numbers that can be duplicated by calling with 1 as the seed.

       The  routine  allows  a state array, passed in as an argument, to be initialized for future use.  The size of the state array (in bytes) is
       used by to decide how sophisticated a random number generator it should use - the more state, the better the random numbers will be.  (Cur-
       rent  "optimal"	values	for  the  amount of state information are 8, 32, 64, 128, and 256 bytes; other amounts will be rounded down to the
       nearest known amount.  Using less than 8 bytes will cause an error).  The seed for the initialization (which specifies a starting point for
       the  random  number  sequence, and provides for restarting at the same point) is also an argument.  returns a pointer to the previous state
       information array.

       Once a state has been initialized, the routine provides for rapid switching between states.  The subroutine returns a pointer to the previ-
       ous state array; its argument state array is used for further random number generation until the next call to or

       Once  a	state  array  has  been  initialized, it may be restarted at a different point either by calling (with the desired seed, the state
       array, and its size) or by calling both (with the state array) and (with the desired seed).  The advantage of calling both and is that  the
       size of the state array does not have to be remembered after it is initialized.

       With  256  bytes  of  state information, the period of the random number generator is greater than 269, which should be sufficient for most
       purposes.

Diagnostics
       If is called with less than 8 bytes of state information, or if detects that the state information has been  garbled,  error  messages  are
       printed on the standard error output.

See Also
       rand(3)

																	 random(3)
All times are GMT -4. The time now is 07:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy