The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
count no of arguments passed to a function satish@123 Shell Programming and Scripting 2 05-21-2008 02:16 AM
counting no of argumnts passed to a function satish@123 Shell Programming and Scripting 4 05-21-2008 12:15 AM
read values from ps -ef into variables in ksh? JamesByars Shell Programming and Scripting 8 01-13-2008 04:12 AM
checking parameter values passed to script ammu UNIX for Dummies Questions & Answers 2 10-05-2007 09:35 AM
Korn Shell Script - Read File & Search On Values run_unx_novice Shell Programming and Scripting 2 06-15-2005 04:20 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-22-2008
prashant43's Avatar
Registered User
 

Join Date: Jan 2008
Posts: 19
How to read values that are passed to the shell function in ksh.

In ksh shell,
There is a function f1.
function f1
{

How to read here??
....
....

}

I am passing values to fuunction f1 as

f1 "A" "B"

Please tell me how to read the passed values in function f1.

Advance Thanks & Regards
Prashant
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 01-22-2008
Moderator
 

Join Date: Dec 2003
Location: /ksh93
Posts: 883
There are probably hundred sof tutorials on the Korn shell available on the Web.
Just use your favorite search engine to find "ksh tutorial function"

Code:
#!/usr/bin/ksh

function foo
{
    echo "Argument 1: $1"
    echo "Argument 2: $2"
    echo "All agruments: $*"
}

bar()
{
    echo "Argument 1: $1"
    echo "Argument 2: $2"
    echo "All agruments: $*"
}

foo one two
bar three four
Reply With Quote
  #3 (permalink)  
Old 01-22-2008
prashant43's Avatar
Registered User
 

Join Date: Jan 2008
Posts: 19
Thanks fpmurphy.

Quote:
Originally Posted by fpmurphy View Post
There are probably hundred sof tutorials on the Korn shell available on the Web.
Just use your favorite search engine to find "ksh tutorial function"

Code:
#!/usr/bin/ksh

function foo
{
    echo "Argument 1: $1"
    echo "Argument 2: $2"
    echo "All agruments: $*"
}

bar()
{
    echo "Argument 1: $1"
    echo "Argument 2: $2"
    echo "All agruments: $*"
}

foo one two
bar three four
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 08:00 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0