Soren Orel <[email protected]> writes:
> u...@debian:~$ $[ ($RANDOM % 30 ) -30 ]
> bash: -26: command not found
[...]
> it still doesn't work, and it gives only negative numbers when using e.g.:
> 30....-30
First, it's giving an error because it's generating a random number,
then trying to run a program with that name. If you try:
echo $[ ($RANDOM % 30 ) -30 ]
it will print the number instead of running it.
Second, "$RANDOM % 30" will give a random number between 0 and 29, so
when you subtract 30 it will always be negative. For -30..30, you
want to have it pick a number between 0 and 60, then subtract 30:
echo $[ ($RANDOM % 61 ) -30 ]
Hope this helps!
----Scott.
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]