screenFetch icon indicating copy to clipboard operation
screenFetch copied to clipboard

RAM display error

Open typr7 opened this issue 4 years ago • 16 comments

image it displays wrong ram but if I switch my language to English Screenshot_2021-02-19_22-37-31 It works well Is there any way to fix this error?

typr7 avatar Feb 19 '21 06:02 typr7

和你一样的问题,根据你的提示,把screenfetch的LANGUAGE指定一下就好了,不影响你外面的全局locale

hehh2001 avatar Feb 27 '21 05:02 hehh2001

It looks like this happens whenever you have a language where the word for memory is over a certain length. The result it that free -b returns something like this:

$ LANG=de_DE.UTF-8 free -b                                                                                                                        
              gesamt       benutzt     frei      gemns.  Puffer/Cache verfügbar
Speicher:67344703488 14921134080 46072750080  4848996352  6350819328 46876737536
Swap:    17179865088           0 17179865088

Since the word for mem pushes into the first number, the awk on line 1801 doesn't work.

dalto8 avatar Feb 27 '21 16:02 dalto8

Thanks for your help, edit shell script screenfetch line 1801:

mem=$(free -b | awk 'NR==2{print $2"-"$7}')

to

mem=$(LANG=en_US.UTF-8 free -b | awk 'NR==2{print $2"-"$7}')

can solve this problem

谢谢你们的帮助, 把screenfetch shell脚本的1801行由:

mem=$(free -b | awk 'NR==2{print $2"-"$7}')

改为

mem=$(LANG=en_US.UTF-8 free -b | awk 'NR==2{print $2"-"$7}')

能解决这个问题

typr7 avatar Feb 28 '21 06:02 typr7

I have the same issue with de_DE.UTF-8.

Thaodan avatar Mar 15 '21 01:03 Thaodan

I submitted a PR to resolve the issue a couple of weeks ago.

https://github.com/KittyKatt/screenFetch/pull/708

That being said, there are lot of different ways to fix it.

dalto8 avatar Mar 15 '21 01:03 dalto8

Can any of you try out master now that I merged #708 ?

KittyKatt avatar Mar 19 '21 01:03 KittyKatt

it seems doesn't work

git clone https://github.com/KittyKatt/screenFetch.git
cd screenFetch
./screenfetch-dev

and this is the output image

typr7 avatar Mar 19 '21 04:03 typr7

That's mighty unfortunate. I'll need to take a longer look at it.

KittyKatt avatar Mar 19 '21 04:03 KittyKatt

mem=$(LANG=en_US.UTF-8 free -b | awk 'NR==2{print $2"-"$6}') works for me or replace the full width colon in my case mem=$(free -b | awk 'sub(/:/,":")' | awk -F ':' 'NR==1{print $2}' | awk '{print $1"-"$6}')

daxiaraoming avatar Mar 22 '21 08:03 daxiaraoming

mem=$(LANG=en_US.UTF-8 free -b | awk 'NR==2{print $2"-"$6}') works for me

Does this require the en_US.UTF-8 locale to be enabled on your system? Maybe LANG=C instead?

dalto8 avatar Mar 22 '21 12:03 dalto8

LANG=C would be better if someone could test that. We can't guarantee everyone has en_US enabled.

KittyKatt avatar Mar 22 '21 16:03 KittyKatt

LANG=Cworks for me

daxiaraoming avatar Mar 23 '21 01:03 daxiaraoming

I'll try to get a fix tested tomorrow at work and committed to close this and the other issues about this.

KittyKatt avatar Mar 23 '21 03:03 KittyKatt

LC_ALL=C screenfetch does the trick. At least for me

nobbe64 avatar Apr 26 '21 18:04 nobbe64