Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: ***** Parameter file in a shell script *****

Re: ***** Parameter file in a shell script *****

From: Carel-Jan Engel <cjpengel.dbalert_at_xs4all.nl>
Date: Tue, 2 Mar 2004 08:28:14 +0100 (CET)
Message-ID: <22650.145.61.28.21.1078212494.squirrel@webmail.xs4all.nl>


As long as the parameterfile contains assignments, as shown, you can simply execute the parameterfile within your script When you do so with the command:
. script.par
the file doesn't have to be executable. Mind the . and the space behind it. This lets your script.par be executed within the same shell process as your script self, and makes the parameterfile an initialisation script.

Another way might be:

# Start of your script

.
.
.

name=`grep name script.par|sed 's/.*=//'`;export name city=`grep city script.par|sed 's/.*=//'`;export city
.
.
.

rest of script

OR

# Start of your script

.
.
.

export name=`grep name script.par|sed 's/.*=//'` export city=`grep city script.par|sed 's/.*=//'`
.
.
.

rest of script

Can be enhanced, but I have no time to elaborate right now.

Regards, Carel-Jan

===
If you think education is expensive, try ignorance. (Derek Bok) ===

>
> Hi All,
> I need an urgent help with a complex situation. I really appreciate your
> help!
> I have a parameter file like this.
> unix> cat script.par
> name=david
> city=phoenix
> job=(admin,manager)
> admin_role=(calls,meetings,gusts)
> manager_role=(meetings,workers)
> age=60
> I have to use the above parameters in a shell script. Since the number of
> parameters are high I can't pass them as $1.. $10 etc in the command
> prompt. Number of parameters in script.par can vary.
> In the shell script I need to read the values in script.par and assign
> them to different variables as shown below!
> name=david
> city=phoenix
> job_1=admin
> job_2=manager
> admin_role_1=calls
> admin_role_2=meetings
> admin_role_3=gusts
> manager_role_1=meetings
> manager_role_2=workers
> age=60
> Please let me know how to achieve this. I hope I am clear on my questions.
> I appreciate your help.
> Thank you so much!
> Have a great day,
> Sam
>
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Search - Find what you’re looking for faster.

Regards, Carel-Jan

===
If you think education is expensive, try ignorance. (Derek Bok) ===



Please see the official ORACLE-L FAQ: http://www.orafaq.com

To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------
Received on Tue Mar 02 2004 - 01:25:02 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US