I used printf "%0.2f\\n" $myVar method to display something on 2 decimal places, but it doesnt work for numbers with dot (.) as decimal mark, but comma(,)
Anybody has any idea what should i do?
Try setting your locale environment variable LC_NUMERIC to some locale that uses period. Eg
LC_NUMERIC="C" printf "%0.2f\n" 3.1415
The locale needs to be installed in your system. To get full list of the locales installed, use locale -a
PROBLEM WAS LOCALE as someone pointed out I didnt know what caused error and i thank you.
more on this link /bin/bash printf does not work with other LANG than C
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.