Resolve parameter value stored in a variable


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Resolve parameter value stored in a variable
# 1  
Old 06-17-2013
Resolve parameter value stored in a variable

Hi All,

I have below variable,

xyz=\$AI_XFR

Now, if you will run the below command

=> echo $xyz
$AI_XFR

It is returning hardcoded string value.

Whereas in environment, there is value in it. Like below:

=> echo $AI_XFR
/home/aditya/sandbox/xfr/

I need to resolve this value using variable '$xyz'.

Please suggest.

Thanks,
Aditya Gangwar
# 2  
Old 06-17-2013
You could use eval
# 3  
Old 06-17-2013
Hi,

Can you please tell in detail,
I have hardcoded value $AI_XFR in variable 'xyz'
and now i want to resolve the value with 'xyz' variable only.

Thanks,
Aditya
# 4  
Old 06-17-2013
Code:
eval echo $xyz

This User Gave Thanks to Yoda For This Post:
# 5  
Old 06-17-2013
Thanks a lotSmilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cannot resolve $variable in awk

My script ---------- for i in `cat n`;do export k=`echo "CSN: "$i` //combining CSN: and value from n echo "$k" awk ''{print "CSN: "$0;}'{_=29}_&&_--' file1|tail -1 >> file2 done In the above script i cannot able to resolve $k in awk command file n contains ------------ 0000 1111 2222... (2 Replies)
Discussion started by: Mohana29_1988
2 Replies

2. Shell Programming and Scripting

Resolve variable inside another variable

Hello Everyone, I am trying to resolve a variable inside another variable.Let me go straight to the example. Input: Query=$Table_1 Join $Table_2 (Query itself is a variable here) Now for two different cases I am assigning different values to Table_1 and Table_2 Case 1:... (14 Replies)
Discussion started by: vinay4889
14 Replies

3. Shell Programming and Scripting

Resolve Environment Variable

I am tyring to resolve an environment variable that is part of a string I selected from our database. Simply put, I want cd to this folder before checking if a file exists. The variable $in_loc has the value '$PS_HOME/int/VSP' where $PS_HOME is the environment variable. I am using cd... (6 Replies)
Discussion started by: consult_jb
6 Replies

4. Shell Programming and Scripting

How to get OUT parameter of a stored procedure in shell script?

I am invoking a SQL script from shell script. This SQL script will invoke a stored procedure(which has the OUT parameter). I want to have the OUT parameter in the shell script as a variable. Is this possible? (6 Replies)
Discussion started by: vel4ever
6 Replies

5. Shell Programming and Scripting

How to call stored procedure with CLOB out parameter from shell script?

I have written a stored procedure in oracle database, which is having a CLOB OUT parameter. How can i call this stored procedure from shell script and get the CLOB object in shell script variable? (0 Replies)
Discussion started by: vel4ever
0 Replies

6. Shell Programming and Scripting

Variable not found error for a variable which is returned from stored procedure

can anyone please help me with this: i have written a shell script and a stored procedure which has one OUT parameter. now i want to use that out parameter as an input to the unix script but i am getting an error as variable not found. below are the unix scripts and stored procedure... ... (4 Replies)
Discussion started by: swap21783
4 Replies

7. Shell Programming and Scripting

How to define a variable with variable definition is stored in a variable?

Hi all, I have a variable say var1 (output from somewhere, which I can't change)which store something like this: echo $var1 name=fred age=25 address="123 abc" password=pass1234 how can I make the variable $name, $age, $address and $password contain the info? I mean do this in a... (1 Reply)
Discussion started by: freddy1228
1 Replies

8. Linux

Incrementing the date stored in the variable

Hi all, I have a variable with date as 20080831 . Now I want to increment it as 20080901 and so on.Is there any command for this. Please help me. thanks rameez (1 Reply)
Discussion started by: rameezrajas
1 Replies

9. Shell Programming and Scripting

passing parameter 4m shell script to a DB stored procedure

hi all please tell me how to pass parameters 4m shell script to a DataBase stored procedure. To be specific i have sybase DB. i mean i want the syntax of the command.. how to connect to DB, pass user id and password, pass the required parameter to SP.. .. need ur help frnds.. hema (0 Replies)
Discussion started by: hema2026
0 Replies

10. Shell Programming and Scripting

Resolve a Variable

Hi I have a variable which is a path ie: UBERROR=/cobwrk/mchr/prodsup/ub/wrk/../error is there anyway I can get the output of an echo to read: #echo $UBERROR /cobwrk/mchr/prodsup/ub/error instead of #echo $UBERROR /cobwrk/mchr/prodsup/ub/wrk/../error Many thanks! (2 Replies)
Discussion started by: serm
2 Replies
Login or Register to Ask a Question