Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8956563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:48:55+00:00 2026-06-15T14:48:55+00:00

Iam facing this problem for past 2/3 days. I have a simple script in

  • 0

Iam facing this problem for past 2/3 days. I have a simple script in which i will read a property file and output some of the contents. This is my script

vi testloop.properties
dump_1=abc


vi testloop.sh
. testloop.properties
i=1
dmp="dump_"$i  //as per my understanding dmp=dump_1
echo $dump_1   //abc will echod since dump_1 in property file is abc
echo $dmp      ***i thought here also abc will come but unfortunately it is "dump_1"***
echo $(($dmp)) ***here output is 0*** 


sh testloop.sh
abc
dump_1
0

Can some one help me in pointing out what has happend in echo $dmp and echo $(($dmp)) . why it is not echoing abc

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:48:57+00:00Added an answer on June 15, 2026 at 2:48 pm

    dmp="dump_"$i

    This assigns the string "dump_1" rather than the variable dump_1 to dmp.

    The other example you gave tries to do arithmetic expansion of $dmp which in this case is just 0.

    Normally the variable assignment would be dmp=$dump_1, which is fine, but variable variable assignment, i.e. dmp=$dump_$i doesn’t work as you might hope. You can pass it through an eval statement like so:

    eval dmp=\$dump_$1

    But if you really need variable variables of this nature it might be better to use an array:

    i=1
    dump[1]='abc'
    dmp=${dump[$i]}
    echo ${dump[$i]}
    echo $dmp
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am facing this problem. I have a stored procedure which returns 6 rows
iam facing problem in passing array to view. this is my controller code.. function
I am facing a strange problem and have no idea how to fix this
This is a design problem I am facing. Let's say I have a cars
While using method Arrays.deepToString(Object [] a) I am facing this problem which I can
ohk i am facing this very weird problem . i have a cloud server
I have been struggling with this issue for the past couple days: I have
I am facing this very weird problem, I have created a custom UITableViewCell on
I am facing this problem: stackoverflow question except my host doesn't seem to have
I am facing this problem upon pushing my app to Heroku: 500 internal server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.