Shell Example: generating random integers with $RANDOM

Source: Internet
Author: User
The code is as follows:
#!/bin/bash# $RANDOM 在每次调用的时候,返回一个不同的随机整数# 指定的范围是: 0 - 32767 MAXCOUNT=10count=1echoecho "$MAXCOUNT random numbers:"echo "-----------------"while [ "$count" -le $MAXCOUNT ] # 产生 10 ($MAXCOUNT) 个随机整数do    number=$RANDOM    echo $number    let "count += 1" # 数量加 1doneecho "-----------------"
Let instruction usage:
自加操作 let no++自减操作 let no--简写形式 let no+=10,let no-=20,分别等同于let no=no+10,let no=no-20

Shell Example: generating random integers with $RANDOM

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.