Solved

bash

Posted on 2011-09-29
5
183 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
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…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now