double substitution


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting double substitution
# 1  
Old 07-03-2008
Bug double substitution

Hello,
I would like to dual subtitutes variables.

I tried

Code:
$serv="combo"
combo_TYPE="mop"

TYPENAME="$serv_TYPE" 

Now, I'd like to get "mop" from TYPENAME

echo "${${TYPENAME}}"

I have a bad substitution error

Smilie

Last edited by pppswing; 07-03-2008 at 05:12 AM..
# 2  
Old 07-03-2008
possible sollution try it

i dont know whether you are looking for this or not ..i hope so

Code:
 var1='malay'
 var2=$var1

 val=$(echo $var2)
  
  eval echo $val ----> o/p will be malay


Last edited by rbatte1; 12-13-2016 at 09:42 AM.. Reason: Added CODE tags
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace double quotes with a single quote within a double quoted string

Hi Froum. I have tried in vain to find a solution for this problem - I'm trying to replace any double quotes within a quoted string with a single quote, leaving everything else as is. I have the following data: Before: ... (32 Replies)
Discussion started by: pchang
32 Replies

2. UNIX for Dummies Questions & Answers

Double variable substitution

$ ABCel='abc@gmail.com' $ XYZel='xyz@gmail.com' $ MYel='my@yahoo.com' $ echo $ABCel abc@gmail.com $ echo $XYZel xyz@gmail.com $ echo $MYel my@yahoo.com I tried 3 variations, but not getting the expected result: $ for VAR in ABC XYZ; do echo -e "${VAR}el $MYel"; done ABCel... (1 Reply)
Discussion started by: bagnoble
1 Replies

3. Shell Programming and Scripting

Replace double double quotes using AWK/SED

Hi, I have data as "01/22/97-"aaaaaaaaaaaaaaaaa""aaa""aabbbbbbbbcccccc""zbcd""dddddddddeeeeeeeeefffffff" I want to remove only the Consequitive double quotes and not the one which occurs single. My O/P must be ... (2 Replies)
Discussion started by: Bhuvaneswari
2 Replies

4. Shell Programming and Scripting

Using echo to print double quotes along with variable substitution

Hi, I am generating html code using cshell, but i am having one problem while printing double quotes, I need to write following code in file. where $var contains list of web address <a href="$var">$var</a> So i am using echo "<a href="$var">$var</a>" > file.html But with this " in... (4 Replies)
Discussion started by: sarbjit
4 Replies

5. Shell Programming and Scripting

How do I perform double substitution in bash?

#!/bin/bash #set -x MAX=255 FILE=$1.dns_list #declare -a d_arr if then echo "Usage: `basename $0` network" echo " e.g.`basename $0` 1.1.1" exit fi echo "Remove file $FILE..." rm $FILE for (( i = 1; i < $MAX; i++ )) do PARSE=$(host $1.${i}) ... (3 Replies)
Discussion started by: flee
3 Replies

6. Shell Programming and Scripting

Difference between "Command substitution" and "Process substitution"

Hi, What is the actual difference between these two? Why the following code works for process substitution and fails for command substitution? while IFS= read -r line; do echo $line; done < <(cat file)executes successfully and display the contents of the file But, while IFS='\n' read -r... (3 Replies)
Discussion started by: royalibrahim
3 Replies

7. Programming

double pow (double x, double y) -- problems

This is the code and I'm wondering why line 14: a = ... and line 16: b = ... is wrong. This is the first time I've tried to use this. Please help me. #include <stdio.h> #include <math.h> // The link and how the double pow is used. // // http://www.nextdawn.nl/c-reference/pow.php //... (2 Replies)
Discussion started by: pwanda
2 Replies

8. UNIX for Dummies Questions & Answers

Need help in substitution!!!!

In a file I want to globally change a "|" charater by a new line character. I am using the command 1,$s/\|/??/g Can anybody say what should I put in place of ?? in the above command? (3 Replies)
Discussion started by: uLearner
3 Replies

9. Shell Programming and Scripting

Double Substitution variables in ksh

Hi I have a variable whose value is like this i=/test/test1/test2/myfile.cd.070505123457 i would like to have the value of myfile.cd stored into another variable my attempt is test=${i##*/} ;echo $test ##and i get myfile.cd.070505123457 since what i wnat is myfile.cd i try this... (19 Replies)
Discussion started by: xiamin
19 Replies

10. UNIX for Dummies Questions & Answers

double variable substitution

Hi, I want to substitute variable in sed using combination of name and var_$name: name=Tom var_$name=1 sed -n "${var_"$name"}"p < myfile but it doesn't work, do you know what's wrong ? Thanks (1 Reply)
Discussion started by: asal_email2
1 Replies
Login or Register to Ask a Question