DISQUS

Tech-Recipes: Bourne/bash shell script functions | Bourne shell scripting | Tech-Recipes

  • kishroe · 11 months ago
    simple to understand and very good for bushing up the unix
  • Khushbu · 11 months ago
    wat will be the output of
    [-z "$2"]; echo $;
    sh amit
  • vaiju · 3 months ago
    The article was very useful. Thanks a ton !!!
  • neerajnandwana · 1 month ago
    i found some problem with the second code
    so i modified like this :)

    #!/bin/bash
    sum()
    {
    if [ -z "$2" ]
    then
    echo "sum: $1"
    else
    local a=`expr $1 + $2`
    shift 2
    sum $a $@
    fi
    }
    sum 3 5 34
  • Penton · 1 month ago
    You can use return to return the result generated within a function. Please read more about this within the following URL:

    http://www.faqs.org/docs/abs/HTML/functions.html
    (Example 23-3. Maximum of two numbers)