반응형
참고> https://www.unix.com/shell-programming-and-scripting/267297-generating-posix-random-number.html
예제>
root>:/www/cgi-bin# cat /tmp/xx.sh
#!/bin/sh
for n in {1..4}
do
TMP=$(awk ' BEGIN { srand(); printf( "%d %d\n", 16 * rand(), 16 * rand() ); }')
byteone=${TMP% *}; bytetwo=${TMP#* }
echo "$byteone $bytetwo"
#sleep 1
done
root>:/www/cgi-bin# /tmp/xx.sh
0 5
root>:/www/cgi-bin# /tmp/xx.sh
3 2
root>:/www/cgi-bin# /tmp/xx.sh
6 7
root>:/www/cgi-bin# /tmp/xx.sh
12 6
root>:/www/cgi-bin#
반응형
'프로...Linux' 카테고리의 다른 글
[util] partition/mount - fdisk/lsblk(blkid)/df/mount (0) | 2018.12.14 |
---|---|
[SVN] Repository 추가 생성 (0) | 2018.11.15 |
[sh] predefined variables(special) (0) | 2018.09.28 |
[Linux/WEB] APM 설치 (0) | 2018.08.07 |
[Linux/SYS] 절전모드 / Hostname 등 (0) | 2018.08.07 |