Solved

bash

Posted on 2011-09-29
5
188 Views
Last Modified: 2012-05-12
hum-tum_tit_for_tat_SIZE = 40

INST = hum-tum

 eval TEMP_SIZE="$"${INST}_tit_for_tat_SIZE

it is not evaluating to 40 rather it is evaluating to -tum_tit_for_tat_SIZE
can you pls fix it

the answer should come as
TEMP_SIZE to 40  
but ima getting wrong answer as
TEMP_SIZE = -tum_tit_for_tat_SIZE

0
Comment
Question by:damodar4u
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 31

Accepted Solution

by:
farzanj earned 334 total points
ID: 36839804
Try this:

TEMP_SIZE=$(eval echo \$${INST}_tit_for_tat_SIZE)

Sorry don't have shell at this time to test.
0
 
LVL 31

Expert Comment

by:farzanj
ID: 36839928
But if you give me the feed back I can probably fix any problems
0
 
LVL 31

Assisted Solution

by:farzanj
farzanj earned 334 total points
ID: 36840558
There appears to be another problem.  The variable name hum-tum is invalid.  Dash is an invalid character in the variable name
0
 

Author Comment

by:damodar4u
ID: 36843614
how to overcome that is there any fix that i want to use - in variable names.
0
 
LVL 84

Assisted Solution

by:ozo
ozo earned 166 total points
ID: 36891098
The fix is to use alphanumeric  characters and underscores in variable names.
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

by Batuhan Cetin Regular expression is a language that we use to edit a string or retrieve sub-strings that meets specific rules from a text. A regular expression can be applied to a set of string variables. There are many RegEx engines for u…
Over the years I've spent many an hour playing on hardened, DMZ'd servers, with only a sub-set of the usual GNU toy's to keep me company; frequently I've needed to save and send log or data extracts from these server back to my PC, or to others, and…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Six Sigma Control Plans

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question