Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to declare functions in unix shell script?

Answer Posted / pitambar mishra

### Note : Function always returns a value.
### This script is for adding two numbers.
### Script name : add.ksh

#!/bin/ksh

sum() ### Defining sum function
{
echo enter 2 no :
read num1 num2
echo sum=$(( num1 + num2 ))
}
sum ### Invoking sum function

To execute it :
ksh add.ksh

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What will happen to my current process when I execute a command using exec?

1125


What is bash command used for?

1113


What is eval in shell script?

1324


one folder contains lot of students name but I want to fetch hello with every student name individually using shell script

996


Where are cowrie shells found?

1066


Calculate a real number calculation directly from the terminal and not any shell script.

1286


What is meant by $1 in shell script?

993


How do I run a shell script on a mac?

1185


Write a shell script to get current date, time, user name and current working directory.

1131


Is shell a part of kernel?

1112


What lives in a shell?

1005


What is bash coding?

972


what is info area how many types?

2816


How will you pass and access arguments to a script in linux?

1235


how to get part of string variable with echo command only?

1066