KittyKatt / screenFetch

Fetches system/theme information in terminal for Linux desktop screenshots.
GNU General Public License v3.0
3.82k stars 453 forks source link

RAM display error #704

Open typr7 opened 3 years ago

typr7 commented 3 years ago

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?

hehh2001 commented 3 years ago

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

dalto8 commented 3 years ago

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.

typr7 commented 3 years ago

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}')

能解决这个问题

Thaodan commented 3 years ago

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

dalto8 commented 3 years ago

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.

KittyKatt commented 3 years ago

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

typr7 commented 3 years ago

it seems doesn't work

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

and this is the output image

KittyKatt commented 3 years ago

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

daxiaraoming commented 3 years ago

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}')

dalto8 commented 3 years ago

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?

KittyKatt commented 3 years ago

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

daxiaraoming commented 3 years ago

LANG=Cworks for me

KittyKatt commented 3 years ago

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

nobbe64 commented 3 years ago

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