topical media & game development

talk show tell print

basic-shell-extra-10-recursion.sh / sh



  #!/bin/bash
  
  countdown() {
  
        if [ $1 -lt 0 ]
        then
          echo “Blast off!”
          return 0
        fi
  
        current_value=$1
        echo current_value
        current_value=`expr $1 - 1`
        countdown current_value
  }
  
  countdown 10
  
  if [ ? -eq 0 ]
  then
    echo “We have lift-off!”
    exit 0
  fi
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.