Access another variable config variable


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Access another variable config variable
# 1  
Old 05-29-2015
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
Code:
wesly=1
wina=2
wekin=3

variabletaker.sh
Code:
source variable.sh

echo $wesly

when i run the variabletaker.sh
the error result is like here


error
Code:
source: variable.sh: file not found

Thank before..

i am working on /bin/bash
# 2  
Old 05-29-2015
Hi

Are the files in the same path?
If not, either put them in the same, or considider putting relative or absolute paths in front of the filenames.

Hope this helps
# 3  
Old 05-29-2015
Try:-
Code:
source ./variable.sh

OR
Code:
source /full/path/to/variable.sh

Ensure permissions are set correctly for 'variable.sh'...
# 4  
Old 05-30-2015
Succes suggestion

Thank you Mr Wisecracker.
Your suggest is worked.

When I work in sh shell I actually succes without
Code:
.\

before the file name.
SmilieSmilie.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Fetching variable from config file

I am using . .profile in my script below I want to fech it it from my configuration file .id_pass_file.txt(it has all user_name and passwords) how can i do this PROFILE_PATH=. .profile AND IN MY SCRIPT $PROFILE_PATH IS THIS CORRECT #!/bin/sh ORACLE_HOME=/var/opt/oracle/product/10g;... (8 Replies)
Discussion started by: rafa_fed2
8 Replies

2. 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

3. 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

4. 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

5. Programming

access variable through program stack

I am working on garbage collector in C? How should :confused: I find the part of heap where the variable are stored. It there any compiler (GCC) support for this. (2 Replies)
Discussion started by: amit gangarade
2 Replies

6. 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

7. Shell Programming and Scripting

how to access a variable value

hi i have a function abc() { a=1 b=2 c=3 } Now i want to assign these values to the variables out side the function k=a l=b m=c please help (4 Replies)
Discussion started by: satish@123
4 Replies

8. 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

9. Shell Programming and Scripting

shell variable access

Hi I want to do the following: 1. Create a number of Gloabla varibale "ROUTE_IP_xx" based on a counter. As xx sould be from 1-10. ie ROUTE_IP_1 ROUTE_IP_2 . . ROUTE_IP_10 2. I want to initalize all of these variable to 0.0.0.0 ie ROUTE_IP_1='0.0.0.0' 3. I... (2 Replies)
Discussion started by: sabina
2 Replies
Login or Register to Ask a Question