-   Linux - General (
-   -   assigning a value with special characters (

nano2 06-27-2012 02:27 AM

assigning a value with special characters
Have the following scenario where by i have a mixture of integer values and special chars in a value and want to assign it to another value .


value1 = 3,6789

value2= $value1

expected  value2 = 3,6789

actual value2 '3 6789' is not a valid integer

using GNU bash, version 3.2.25

Any ideas how to solve this ?

catkin 06-27-2012 08:46 AM

IDK where "actual value2 '3 6789' is not a valid integer" comes from ... ?

The bash assignment operator "=" must not have space either side of it so the code should be



That will work but 3,6789 is not a valid integer; use 36789 instead.

nano2 06-27-2012 11:28 AM

I need the comma in it .
I have tried douuble quotes but then i get a comma replaced with a space

Any ideas to get this value2=3,6789

pan64 06-27-2012 01:18 PM

I have tried and worked for me:

echo $a
echo $b

just remove space before and after =

All times are GMT -5. The time now is 06:36 PM.