home *** CD-ROM | disk | FTP | other *** search
/ linuxmafia.com 2016 / linuxmafia.com.tar / linuxmafia.com / pub / humour / beerscript < prev    next >
Text File  |  2002-11-09  |  504b  |  29 lines

  1. #!/bin/bash
  2. # Bourne Again shell version of 99 Bottles
  3. # Dave Plonka - plonka@carroll1.cc.edu
  4.  
  5. typeset -i n=99
  6. typeset bottles=bottles
  7. typeset no
  8.  
  9. while [ 0 != $[ n ] ]
  10. do
  11.    echo "${n?} ${bottles?} of beer on the wall,"
  12.    echo "${n?} ${bottles?} of beer,"
  13.    echo "take one down, pass it around,"
  14.    n=n-1
  15.    case ${n?} in
  16.    0)
  17.       no=no
  18.       bottles=${bottles%s}s
  19.       ;;
  20.    1)
  21.       bottles=${bottles%s}
  22.       ;;
  23.    esac
  24.    echo "${no:-${n}} ${bottles?} of beer on the wall."
  25.    echo
  26. done
  27.  
  28. exit
  29.