![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Can we pass array with call by value in function | ranjithpr | Shell Programming and Scripting | 1 | 12-26-2007 09:22 AM |
| Pass argument to function | Knotty | UNIX for Dummies Questions & Answers | 1 | 04-08-2007 05:26 AM |
| How to pass CSH variables up to the parent? | ElCaito | Shell Programming and Scripting | 0 | 11-29-2006 11:30 PM |
| how to pass variables surrounded in double quotes to awk? | cruiser | AIX | 4 | 03-24-2006 02:12 PM |
| Pass multiple variables to SQL script | jagannatha | Shell Programming and Scripting | 1 | 10-25-2002 06:45 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
How to pass variables to FUNCTION ?
Hi...
Actually, I want to pass a few variables to the function and print it. But, its looks like not working. Could some body help me how could i do that ?... below is my program... PHP Code:
|
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Try this...
This is what you want
myfunc() { echo "read var1 "$1 echo "read var1 "$2 } myfunc 1 2 |
|
#3
|
|||
|
|||
|
As example:
lets say i run it as #./script.sh -r -i input -o output Then, the programm will passed "input" and "ouput" to rename function and print it as below:- # rename input output Now its blank and not print anything... Anyway I have tried your solution but its same... and result has been print out.. |
|
#4
|
|||
|
|||
|
hmm... i have got it...
....Something wrong with the getopt declaration..... |
|
#5
|
|||
|
|||
|
Your color coding is excellent.
|
|
#6
|
||||
|
||||
|
The colon must follows the option
Code:
while getopts ri:o: opt |
||||
| Google The UNIX and Linux Forums |