Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 191
  • Last Modified:

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

0
damodar4u
Asked:
damodar4u
  • 3
3 Solutions
 
farzanjCommented:
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
 
farzanjCommented:
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
 
ozoCommented:
The fix is to use alphanumeric  characters and underscores in variable names.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now