Current Path : /compat/linux/usr/share/doc/bash-3.2/scripts/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //compat/linux/usr/share/doc/bash-3.2/scripts/randomcard.bash |
# The following prints a random card from a card deck. # # cribbed from the ksh93 book, example from page 70 # # chet@po.cwru.edu # declare -i i=0 # load the deck for suit in clubs diamonds hearts spades; do for n in ace 2 3 4 5 6 7 8 9 10 jack queen king; do card[i]="$n of $suit" i=i+1 # let is not required with integer variables done done # and print a random card echo ${card[RANDOM%52]}