how to generate random numbers in a shell script?
Eugeneapolinary Ju
eugeneapolinary81 at yahoo.com
Tue Oct 6 19:16:09 UTC 2009
# something=$[ ($RANDOM % 59 ) ]
# echo $something
29
ok, but if I put it in a script:
# echo -e '#!/bin/bash\nsomething=$[ ($RANDOM % 59 ) ]'>test.sh
# cat test.sh
#!/bin/bash
something=$[ ($RANDOM % 59 ) ]
# sh test.sh
test.sh: 2: Syntax error: "(" unexpected
Why??
Thank you! :S
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20091006/bc5bb467/attachment.html>
More information about the ubuntu-users
mailing list