![]() |
|
|
|
|
|||||||
| 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 |
| Accessing PL/SQL OUT variables in Korn Shell Script | bright_future | UNIX for Advanced & Expert Users | 4 | 2 Days Ago 09:02 AM |
| Accessing Shell Variables in awk or sed | nasersh | Shell Programming and Scripting | 3 | 05-05-2008 04:44 AM |
| snmp ... mib2c.scalar.conf, how manipulate variables | zainab | IP Networking | 0 | 04-11-2008 09:51 PM |
| accessing unix variables in oracle | ravi raj kumar | High Level Programming | 1 | 02-06-2008 08:05 AM |
| accessing ksh variables from awk | trupti wagh | Shell Programming and Scripting | 1 | 02-26-2007 01:11 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Accessing Variables from .conf file
I can't figure out how to access variables that are stored in a separate file. Can someone let me in on the secret? Please, and thank you.
-Kevin |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
if they're asking for system environment variables, you can echo the variables and find the path, or i believe you can use "set env" commands. i haven't needed to do that very often though. i might also be mis-understanding what you're asking and be completely way off base.
|
|
#3
|
|||
|
|||
|
I need to define variables in a file called usermon.conf and then read in the variables from my main program to use there. I can do the rest of the program, by defining the variables in the program, but I can't figure out how to read in variables from another file.
|
|
#4
|
|||
|
|||
|
One example of many ways to read config data
Example contents of a config file name my.config
_____________________________ Some config data _____________________________ In program that needs config file info ___________________ #!/bin/ksh #my example program read configline <my.config echo "The config data is $configline" ___________________ Another example with same config file _____________________________ #!/bin/ksh #my second example program read one two three<my.config echo "The first word was $one" echo "The second word was $two" echo "The third word was $three" _____________________________ |
|
#5
|
|||
|
|||
|
can't you just source the file like this
Code:
#!/usr/bin/ksh . usermon.conf #reads the file into the current script Code:
myvar1="whatever1" myvar2="whatever2" myvar3="whatever3" i could be completely wrong... i need to install unix at home so i can verify the crap i'm trying to remember from work! |
|
#6
|
|||
|
|||
|
so, for example, if I were to do
source usermon.conf it should work? or how should I be using it, because at present it doesn't work right. Thanks. |
|
#7
|
|||
|
|||
|
Thanks for the help. I got it working. I had an error in my conf file that was causing the source usermon.conf to not work.
Thanks -Kevin |
|||
| Google The UNIX and Linux Forums |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|