How to change the value of value in BASH ??

Posted by debugger on Stack Overflow See other posts from Stack Overflow or by debugger
Published on 2010-03-24T22:26:29Z Indexed on 2010/03/24 22:33 UTC
Read the original article Hit count: 281

Filed under:
|
|
|

Hello All,

Let's say i have the Following,

Vegetable=Potato ( Kind of vegetable that i have )

Potato=3 ( quantity available )

If i wanna know how many vegetables i have (from a script where i have access only to variable Vegetable), i do the following:

Quantity=${!Vegetable}

But let's say i take one Potato then i want to update the quantity, i should be able to do the following:

${Vegetable}=$(expr ${!Vegetable} - 1)

It does not work !!

Any clues to realize this

Thanks

© Stack Overflow or respective owner

Related posts about pointer

Related posts about bash