That ain't workin for me...  That's always returning zero.

Ok, I figured it out  if you call your script "myrandom", then you need 
to do "./myrandom 25" (to generate a number between 1 and 25.

You could also just do "echo $((RANDOM % 25 + 1))" at the command line, 
and bypass the script altogether.  Just replace the 25 with upper limit 
you need, and the 1 with the lower limit.

Any scripters want to whip up a script that will ask for the upper limit 
, and then produce a random number and prompt if another should be done 
(or quit).  Basically keep spitting out random numbers when the user 
asks for one, until they say they've had enough... :)

Shawn


Gustin Johnson wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> 
> For the next meeting, here is a script that will generate a random
> number between 1 and a number that you specify as input.
> 
> #!/bin/bash
> 
> rnumber=$((RANDOM%$1+1))
> echo $rnumber
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.3 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD4DBQFGS5v5wRXgH3rKGfMRApM1AJYwOY6OsSfrASTAmCZ2yWJgxBXwAKCEiVak
> hs8FKTBR/r6L4+uEJZBM5A==
> =bony
> -----END PGP SIGNATURE-----
> 
> _______________________________________________
> clug-talk mailing list
> [email protected]
> http://clug.ca/mailman/listinfo/clug-talk_clug.ca
> Mailing List Guidelines (http://clug.ca/ml_guidelines.php)
> **Please remove these lines when replying

_______________________________________________
clug-talk mailing list
[email protected]
http://clug.ca/mailman/listinfo/clug-talk_clug.ca
Mailing List Guidelines (http://clug.ca/ml_guidelines.php)
**Please remove these lines when replying

Reply via email to