Passing a script file with its associated args
Hi All,
I have a basic doubt about passing args to a script. Is it possible to send a script file along with its associated args as a arg to a function. the snippet is as below. callCode $DIR/bin/gens.ksh $genNbr $genSource $genDest Please advice. Will this work. Thanks. |
you do not need to have anything like callcode, just type:
$DIR/bin/gens.ksh $genNbr $genSource $genDest or probably I misunderstood ... |
Hi,
thanks for your reply. callcode is a method/function for which gens.ksh is being passed as an arg. gens.ksh requires three arguments $genNbr $genSource $genDest. Hope I made clear what is my query (Is it possible to send a script along with its own args as a argument to another function/method). Please advice. thanks |
That is what I trying to explain: you do not need to do anything, just write:
gens.ksh arg1 arg2 arg3 you do not need any function to do that. But you can have: Code:
function callCode { (by the way what kind of language is it?) |
Thanks for your reply. btw its a bash script.
thanks |
You can call the current script with $BASH_SOURCE and the arguments of the current script with $1 (first one) $2 (second one) etc - so maybe something like:
callCode $BASH_SOURCE $1 $2 $3 might work |
Quote:
|
All times are GMT -5. The time now is 09:53 PM. |