Vidhyadhar, it doesn't work. Actually I want to get values like "acc_fund2 KLU_LP acc_fund3 KLU_LTD". When I use echo $DATABASES it prints like acc_fund2 KLU_LP acc_fund3 KLU_LTD and when I use echo "$DATABASES" i get following out put:
Doesn't work. Actually I want to get values like "acc_fund2 KLU_LP acc_fund3 KLU_LTD". When I use echo $DATABASES it prints like acc_fund2 KLU_LP acc_fund3 KLU_LTD and when I use echo "$DATABASES" i get following out put:
There's a newline in the text. With the "normal" echo it is split on the characters in $IFS, and echo reassembles them using $OFS. With the double quotes it's passed as-is. Try this:
I'm not sure what you want to accomplish. If you want DATABASES to be acc_fund2 KLU_LP acc_fund3 KLU_LTD regardless of echoing it with/without quotes, just add -n to this line: DATABASES=`echo -n "select agroup,tgroup from acc_gen..agroups where tgroup in ( $values ).
If you want the double quotes to be part of DATABASES' value, then something like this should do the trick:
DATABASES="\"`echo -n "select agroup,tgroup from acc_gen..agroups where tgroup in ( $values )\""