Hi Guys, I am trying write a wrapper script but I don't have any idea. I have 4 different korn shell scripts and all of them needs some parameters from command line (positional parameter). My script cant be interactive because its supposed to be automated. I am confused how can I write a wrapper script and pass parameters to all of them because all of them needs different parameters. My script is like this
I cannot give parameter as $1 $2 $3 $4 on the wrapper script because it may vary. wrapper script is a individual script can be run from anywhere if copied along with 4 other scripts. So user can give different arguments to it depending on the requirement for example.
one user may give dest_dir, source_dir and user_id different than other user and thts the case most of the time.
It cannot be interactive also so we cannot prompt its supposed to be automated. I believe there is some way to do that by wrapper script
About that get opt example I dint get much of it. Would you mind telling me how it works.
getopts is a ksh function that will assist in parsing command line arguments. You can specify flags with or without options.
Example:
-a
-b <argument>
If you want this script to process different files in different ways with different options, this function will assist. For example, option a could be file type a, option b could mean that it is a file type of b. option x could accept a parameter that is a variable used (perhaps the file name). Use the : after the option on the getopts line to denote a parameter goes with the option.