这是我生成随机数的代码
#!/bin/bash
clear #Clears the screen to make it easier to read the output
echo -n “Creating a new random four digit PIN for access to the site: “
echo $((RANDOM%8999+1000))
如何打印10个随机数?
答案 0 :(得分:1)
您需要使用循环。以下是使用for
循环的代码,但您也可以使用while
循环
#!/bin/bash
clear
echo -n “Creating a new random four digit PIN for access to the site: “
for i in `seq 1 10`;
do
echo $((RANDOM%8999+1000));
done;