bash

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

damodar4uAsked:
Who is Participating?
 
farzanjConnect With a Mentor Commented:
Try this:

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

Sorry don't have shell at this time to test.
0
 
farzanjCommented:
But if you give me the feed back I can probably fix any problems
0
 
farzanjConnect With a Mentor Commented:
There appears to be another problem.  The variable name hum-tum is invalid.  Dash is an invalid character in the variable name
0
 
damodar4uAuthor Commented:
how to overcome that is there any fix that i want to use - in variable names.
0
 
ozoConnect With a Mentor Commented:
The fix is to use alphanumeric  characters and underscores in variable names.
0
All Courses

From novice to tech pro — start learning today.