Added gitignore entries needed to ignore derived objects generated from full build...
[bash.git] / examples / scripts / randomcard.bash
blob9cb6b50c7c5a0b949d178a335af304452d7b5fa6
1 # The following prints a random card from a card deck.
3 # cribbed from the ksh93 book, example from page 70
5 # chet@po.cwru.edu
7 declare -i i=0
9 # load the deck
10 for suit in clubs diamonds hearts spades; do
11 for n in ace 2 3 4 5 6 7 8 9 10 jack queen king; do
12 card[i]="$n of $suit"
13 i=i+1 # let is not required with integer variables
14 done
15 done
17 # and print a random card
18 echo ${card[RANDOM%52]}