############################################################################## # # Author: Marcus Fritzsch # Date: 2003/06/01 # Descr: somthing weired, based on a fortune :o) # ############################################################################## #!/bin/bash max=10 wert=1 if [ -z ${1} ]; then cat << __EOM `basename ${0}` num first num: number of iterations to compute first: initial string to use __EOM else if [ `echo ${1} | egrep '[[:alpha:][:punct:]]'` ]; then echo "\$1 NaN!" exit 1 fi max=${1} if [ ! -z ${2} ]; then wert=${2}; fi fi for (( i=0; ${i} < ${max}; i=$((++i)) )); do echo ${wert} neu="" for (( c=0; ${c} < ${#wert}; c=$((++c)) )); do cur=${wert:c:1} cnt=1 c=$((++c)) while (( ${c} < ${#wert} )) && [[ "X${wert:c:1}" == "X${cur}" ]]; do cnt=$((++cnt)) c=$((++c)) done c=$((--c)) neu=${neu}${cnt}${cur} done wert=${neu} done