How to combine two variable result?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to combine two variable result?
# 1  
Old 10-24-2013
How to combine two variable result?

Hi,

i have two variables i.e

lck_ckm_customer=ckm_customer and(present in some script A)
table=ckm_customer(present in script B)

in script B i am executing this part

Code:
if [ "$lck_$TABLE" != "" ]; then  
  ---
----
----   
fi

Now, while comparing in my log file i am getting this result
Code:
if[ ' lck_ckm_customer ' != ' "" ' ]

but i need value not string..i.e it should do like this

Code:
if[' ckm_customer ' != ' "" ' ]

can anyone suggest me how to combine 2 variables...

Last edited by jim mcnamara; 10-24-2013 at 08:34 AM.. Reason: remove icode tags
# 2  
Old 10-24-2013
See if this link helps.
# 3  
Old 10-24-2013
Variables present in script A are not necessarily present in script B (only if B sources A or A calls B using exported variables)
If table=ckm_customer, $TABLE will expand to nothing.
$lck_ will expand to nothing (unless you assign it somewhere else, invisible to us)
And, finally, which of those variables do you want expanded at all?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Store result variable

Friends have the following problem: cat $PATH_DAT/mr.txt | nawk 'BEGIN { CantPnt=0; NumReg=0; FS="|" } { NumReg++ CantPnt=CantPnt+int($2) } END{ printf... (5 Replies)
Discussion started by: tricampeon81
5 Replies

2. UNIX for Dummies Questions & Answers

I save the result in a variable

I have friends that this command worked perfectly, but I would like to save the result in a variable, which I have not achieved var=prueba.txt echo $var | cut -d "." -f 1 prueba I need to do this but does not work me salida=echo $var | cut -d "." -f 1 echo "result:$salida" ... (8 Replies)
Discussion started by: tricampeon81
8 Replies

3. Shell Programming and Scripting

Result of 'cut' into variable

Hello, I would like to have a result of a cut-command in a variable. The file "t.dat" has the following content: Company 001.239879123.OB1X.672W12.STS UNOLD.001.02 My bash-script: Header="" Header=$(cut -c1-160 t.dat | head -1) echo $Header ... (9 Replies)
Discussion started by: API
9 Replies

4. Shell Programming and Scripting

How to combine two variable strings?

Hi, I have two variables pscmd="ps -exf | grep " pid=15560 When I say var=$( $pscmd $pid ) echo $var it shows output of all processes on the OS rather than just 15560. So, i guess it only executes "ps -exf | grep " rather than "ps -exf | grep 15560" Can you... (2 Replies)
Discussion started by: mohtashims
2 Replies

5. Shell Programming and Scripting

Combine 2 values into single variable

Hi gurus, I need to manipulate the output of a database query. The output contains 2 fields (asset and serial number) and I'd like to combine them into a single value, seperated by whitespace. the orginal data is in seprate fileds and of the following format: asset serial asset serial etc ... (6 Replies)
Discussion started by: melias
6 Replies

6. Shell Programming and Scripting

result in variable

Hi all, I'll try to get a result from a search with "awk" into a variable. It works for those examples: findfirstline=`awk 'BEGIN{ mycount = 1 } { if(mycount == 1 && /^Video/){ row=NR; print row; mycount = 0; }}' ${i}` findlastline=`awk '/^Video/ {row=NR} END{print row}' ${i}` But it... (6 Replies)
Discussion started by: tempestas
6 Replies

7. Shell Programming and Scripting

Two Huge Texts and Combine Result to Third

hi, i want to examine two file and write some codes to a third file. note that seperators are TAB, not space. first file: 192.168.1.1 3 192.168.1.2 2 192.168.3.2 2 192.168.7.3 1 ... second file: 192.168.1.1 1 10.15.1.1 3 30 10.15.2.1 2 40 192.168.1.1 2 10.23.4.5... (3 Replies)
Discussion started by: gc_sw
3 Replies

8. Shell Programming and Scripting

Assign result to variable

Hi friends, firstly, i can run following expression and i took 100 value. sqlplus -s username/password@TTTEST @umt.sql umt.sql exists "select t.deger from parametre t where t.id=30". result of this query =100 i need to assign this value(100) to variable(for example x... (2 Replies)
Discussion started by: temhem
2 Replies

9. Shell Programming and Scripting

combine data of 2 files by variable

my first post ... please be gentle. I have been working on a script to get info out of mysql. Its a support ticket system database OTRS. I can write the subject of open tickets to a text file with a unique user id. I also have a text file with the unique user id, username and email adres. I... (11 Replies)
Discussion started by: dicenl
11 Replies

10. UNIX and Linux Applications

How to get a result of a cmd into variable?

Hi , I am trying following . I need to get a result of an autosys cmd into a unix variable. The autosys cmd is autostatus -G jpm_day_today Please help me in storing the value returned by this cmd into a unix variable. Appreciate your time to read this post. (1 Reply)
Discussion started by: manchau
1 Replies
Login or Register to Ask a Question