Fetching variable from config file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Fetching variable from config file
# 8  
Old 07-23-2013
Do you not want to source/include the appropriate .profile though? You need to have:-
Code:
PROFILE_PATH=". /dir/.profile"

... if you want to just execute:-
Code:
$PROFILE_PATH

... in your script.


You need to check that the account running the script through cron has read permission on whichever .profile you choose to run. Perhaps you should create your owner environment script, e.g. /usr/local/bin/my_env.sh




Robin
# 9  
Old 07-23-2013
Quote:
Originally Posted by rbatte1
Do you not want to source/include the appropriate .profile though? You need to have:-
Code:
PROFILE_PATH=". /dir/.profile"

... if you want to just execute:-
Code:
$PROFILE_PATH

... in your script.


You need to check that the account running the script through cron has read permission on whichever .profile you choose to run. Perhaps you should create your owner environment script, e.g. /usr/local/bin/my_env.sh




Robin
I want to give the absolute path of .profile
My absolute path is /.profile.So i am using
PROFILE_PATH=/.profile
But you are telling to use like this
PROFILE_PATH="/.profile"
It is throwing an error.
I can't create my own .profile in PRODUCTION .So i should avoid that
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to pass the config file lines as variable on the respective called function on a script

I want to make a config file which contain all the paths. i want to read the config file line by line and pass as an argument on my below function. Replace all the path with reading config path line by line and pass in respective functions. how can i achieve that? Kindly guide. ... (6 Replies)
Discussion started by: sadique.manzar
6 Replies

2. Shell Programming and Scripting

Access another variable config variable

Hi all, Please help me on my problem. I want to take a value of variable which the variable is in other file. variable.sh wesly=1 wina=2 wekin=3 variabletaker.sh source variable.sh echo $wesly when i run the variabletaker.sh the error result is like here error (3 Replies)
Discussion started by: weslyarfan
3 Replies

3. Shell Programming and Scripting

Query on fetching a value of variable in script

I have below 3 files in a directory : oktest.txt okcode.txt okfun.txt I was writing a small shell script to just print the names of three files where I took a variable a and assigned it a value ok. a=ok echo "Three files are : $atest.txt $acode.txt $afun.txt" But when I run... (3 Replies)
Discussion started by: simpltyansh
3 Replies

4. Shell Programming and Scripting

how to read the variable indivdually from config file

how to read the variable indivdually ( line by line ) in shell script eg : i have the config file where contain cat /home/user01/ilap/conf/input.conf node.txt node2.txt node3.txt i need to run script like /home/user01/ilap/exe/run.sh /home/user01/ilap/conf/input.conf ... (1 Reply)
Discussion started by: mail2sant
1 Replies

5. Shell Programming and Scripting

Shell script that will compare two config files and produce 2 outputs 1)actual config file 2)report

Hi I am new to shell scripting. There is a requirement to write a shell script to meet follwing needs.Prompt reply shall be highly appreciated. script that will compare two config files and produce 2 outputs - actual config file and a report indicating changes made. OS :Susi linux ver 10.3. ... (4 Replies)
Discussion started by: muraliinfy04
4 Replies

6. Shell Programming and Scripting

Parse config file data to script variable

I have a script with few pre defined variables. Also have a config file. Something like this. # config file # Define Oracle User MOD1_TAG=abcde MOD2_TAG=xyzabc MOD3_TAG=def I need to parse the config file and have each of the value copied to different variables. Please suggest what... (1 Reply)
Discussion started by: souryadipta
1 Replies

7. Shell Programming and Scripting

parsing config file to create new config files

Hi, I want to use a config file as the base file and parse over the values of country and city parameters in the config file and generate separate config files as explained below. I will be using the config file as mentioned below: (config.txt) country:a,b city:1,2 type:b1... (1 Reply)
Discussion started by: clazzic
1 Replies

8. Shell Programming and Scripting

how to read the variable from config file

how to read the variable from config file eg: a.cfg below config file config file which contain a=`hostname` b=250 a.sh is shell script echo "$a and $b" if i run "a.sh 1.cfg" it works but when i declare N number of variable it wont works.. can u please suggest for that ? (1 Reply)
Discussion started by: mail2sant
1 Replies

9. Shell Programming and Scripting

Exporting variable from config file

Hi, I am exporting the environment variable from config file, but when I echo the variable it does not display any value. Here is the snippet of the code #!/bin/sh export ENVIRONMENT_ROOT_DIRECTORY="/cb/$ENVIRONMENT" echo $ENVIRONMENT_ROOT_DIRECTORY ${JAVA_HOME}/bin/java... (2 Replies)
Discussion started by: bhavnabakshi
2 Replies

10. UNIX for Dummies Questions & Answers

How to Read a config file and Assign to Variable

I have removeConfig file, it contains the dir paths for removing. I need to read line by line and assign to variable. any idea? (1 Reply)
Discussion started by: redlotus72
1 Replies
Login or Register to Ask a Question