On 17 Nov 2002, Steve wrote: > Hi everyone, for some reason I can't seem to do basic math in this bash > script I'm creating for a class I'm taking. Here's my code > > #!/bin/bash > isec=`date +%s` > thisec=$isec*$isec-$isec > > I'm just getting the date in seconds, then trying to get a sort of > random number out of it by squaring the result, then subtracting the > original result from the squaring answer (just x²-x). I've tried putting > ('s and `s and 's and "s in all logical places in a weak attempt to > guess. > > My assignment is to create a script that can play Mastermind, the game > where there's a 4-digit number that is chosen randomly, and a person > guesses what the number is. After each guess the game tells you how many > of the numbers you picked are in the correct place (1's 10's 100's or > 1000's) and how many are in the number somewhere, but not in the correct > place. > > I've found the $RANDOM builtin, but I need to create a random number > that's 4 digits long. Any help is RIDICULOUSLY appreciated, THANKS!! >
What is this bash thing you speak of? But seriously... :) you'll probably have better luck with this: http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=bash+shell+random Chris -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]