Modify ↓
#23951 closed defect (fixed)
Startup Shell Script Warning
| Reported by: | Owned by: | team | |
|---|---|---|---|
| Priority: | normal | Milestone: | 24.10 |
| Component: | Core | Version: | tested |
| Keywords: | Linux | Cc: | sebastic |
Description
When I start JOSM in a terminal I see this error/warning message:
/usr/bin/josm: Zeile 61: [: : Ganzzahliger Ausdruck erwartet.
The script in line 61 wants an integer but got something different. I run the code there manually:
$ free --mega
gesamt belegt frei gemeinsam Zwischen verfügbar
Speicher: 16643 8531 484 882 7627 6885
It might work like this:
$ LANG=C free --mega
total used free shared buff/cache available
Mem: 16643 8533 488 876 7621 6890
Running JOSM/1.5 (19230 de) Linux Ubuntu 20.04.6 LTS
Attachments (0)
Change History (4)
comment:1 by , 13 months ago
| Cc: | added |
|---|---|
| Keywords: | Linux added |
| Version: | → tested |
comment:2 by , 13 months ago
This should be more reliable as mentioned in #23837:
if [ "$(awk '/^MemTotal:/ {print int($2 / 1024)}' /proc/meminfo)" -gt 8192 ]; then
i.e.:
$ LC_ALL=de_DE.UTF-8 LANG=de_DE.UTF-8 free --mega | grep '^Mem:' | awk '{print $2}'
$ LC_ALL=de_DE.UTF-8 LANG=de_DE.UTF-8 free --mega | grep '^Speicher:' | awk '{print $2}'
67021
$ LC_ALL=de_DE.UTF-8 LANG=de_DE.UTF-8 awk '/^MemTotal:/ {print int($2 / 1024)}' /proc/meminfo
63916
Or set the locale in the environment for free(1):
if [ "$(LC_ALL=C LANG=C free --mega | grep '^Mem:' | awk '{print $2}')" -gt 8192 ];
comment:4 by , 13 months ago
| Milestone: | → 24.10 |
|---|
Note:
See TracTickets
for help on using tickets.



See r19215.
So following does only work with system language set to English or
C.# If there is more than 8G ram, we can use up to 75% of the memory while still leaving 2G for other things. if [ "$(free --mega | grep '^Mem:' | awk '{print $2}')" -gt 8192 ];Maybe, reading directly from
/proclikecat /proc/meminfois system language independent.