NetBSD sh fails because of bash feature
./nerdfetch: 16: Syntax error: Bad substitution
see https://stackoverflow.com/a/20323801/1430535
It works somehow...
$ sh nerdfetch
nerdfetch: 16: Syntax error: Bad substitution
$ csh nerdfetch
Illegal variable name.
$ ksh nerdfetch
?ffnen von //var/pkg/lib/rpm/packages.rpm fehlgeschlagen
nerdfetch[109]: sysctl: not found
expr: non-integer argument 'idk'
usage: expr expression
___ polluks@host
(.. \ Idk
(<> | 8.2
// \ \ idk/idk MB (%)
( | | /| 0 (rpm)
_/\ __)/_) 19198 days, 40 mins
\/-____\/ ██████████████████
Hm... weird :smile: Unless you've kept your computer alive for over 52 years I don't think that uptime is correct... I'm really not familiar with how BSD shells work so I can't exactly pinpoint what's going wrong :/
By the way I'm not root, it's a free account http://freeshell.org.
At least /sbin/sysctl -n kern.boottime does work, sbin is not in my PATH.
Please read https://stackoverflow.com/questions/13210880/replace-one-substring-for-another-string-in-shell-script carefully: "Note that this feature is not specified by POSIX — it's a Bash extension — so not all Unix shells implement it."
Fixed in 7.1.0
$ sh nerdfetch
nerdfetch: 17: Syntax error: Bad substitution
$ zsh nerdfetch
nerdfetch:131: command not found: sysctl
nerdfetch:185: command not found: sysctl
nerdfetch:185: bad math expression: operand expected at `/ 1024 / 1...'
$ bash nerdfetch
nerdfetch: Zeile 131: sysctl: Kommando nicht gefunden.
nerdfetch: Zeile 185: sysctl: Kommando nicht gefunden.
nerdfetch: Zeile 185: / 1024 / 1024: Syntaxfehler: Operator erwartet. (Fehlerverursachendes Zeichen ist "/ 1024 / 1024").
expr: syntax error
usage: expr expression
___ polluks@host
(.. \ Idk
(<> | 9.3
// \ \ / MiB (%)
( | | /| 476 (bin)
_/\ __)/_) 19734 days, 23 hours, 47 mins
\/-____\/ ██████████████████
Sorry, thought I fixed that
Also, what OS and shell are you currently using? (the one linked to sh)
@polluks Can you please try the latest Git version, assuming you're still on NetBSD?
Well...
nerdfetch: Zeile 129: pkg_info: Kommando nicht gefunden.
sysctl: second level name 'stats' in 'vm.stats.vm.v_free_count' is invalid
sysctl: second level name 'stats' in 'vm.stats.vm.v_page_size' is invalid
nerdfetch: Zeile 215: * / 1024 / 1024: Syntaxfehler: Operator erwartet. (Fehlerverursachendes Zeichen ist "* / 1024 / 1024").
expr: syntax error
usage: expr expression
___ polluks@sdf
(.. \ NetBSD 9.3
(<> | 9.3
// \ \ /0 MiB (%)
( | | /| 0 (pkg)
_/\ __)/_) 29 days, 2:55
\/-____\/ ██████████████████
How about this fallback?
$ free
total used free buffers
Mem: 16274444 15094860 1179584 9102496
Swap: 2097148 0 2097148
It'd probably be better practice to use sysctl, is there a significant difference between FreeBSD's version and NetBSD's?
Also,
nerdfetch: Zeile 129: pkg_info: Kommando nicht gefunden.
Does your NetBSD install not have pkg_info? I thought that was standard for NetBSD...
standard for root...
Am Sa., 13. Jan. 2024 um 22:31 Uhr schrieb Kainoa Kanter < @.***>:
Also,
nerdfetch: Zeile 129: pkg_info: Kommando nicht gefunden.
Does your NetBSD install not have pkg_info? I thought that was standard for NetBSD...
— Reply to this email directly, view it on GitHub https://github.com/ThatOneCalculator/NerdFetch/issues/39#issuecomment-1890773744, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABD5J5ISSRUWT26F4IL22GTYOL4KDAVCNFSM5XEC3OIKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBZGA3TOMZXGQ2A . You are receiving this because you were mentioned.Message ID: @.***>
Wdym "standard for root"? How do you manage packages?
I‘m a NetBSD user, I‘m unable to manage packages at all.
But as a user, you can't even query installed packages?!
Well, I have pkgconf and this
$ ls /usr/pkg/bin | which wc
2385 2385 23246
Am So., 14. Jan. 2024 um 16:55 Uhr schrieb Kainoa Kanter < @.***>:
But as a user, you can't even query installed packages?!
— Reply to this email directly, view it on GitHub https://github.com/ThatOneCalculator/NerdFetch/issues/39#issuecomment-1890989823, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABD5J5ID6ZP5LLLOMIVSDRTYOP5VRAVCNFSM5XEC3OIKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBZGA4TQOJYGIZQ . You are receiving this because you were mentioned.Message ID: @.***>
By the way every fetch has this issue
$ ./afetch
pkg_info: not found
\\`-______,----__
\\ __,---`_ USER polluks
\\ `.____ OS NetBSD
\\-______,----`- KERNEL 9.3
\\ UPTIME 0h 0m
\\ SHELL zsh
\\ PKGS 0
I think your setup might just be a bit to esoteric to globally support... I can try and pull something off but it might literally only benefit you 😆 not that I'm opposed
Sorry for interrupting the talk but what shell are you using @polluks?
Also for memory (available/free), NetBSD doesn't have sysctl entry for this, there are separate module for it but not possible to call from a shell script. For now, you can use vmstat, (e.g. mem_free=$(($(vmstat | awk 'NR==3 {print $4}') / 1024)))
Everything else looks okay to me, except a few minor nitpicks
By the way every fetch has this issue
$ ./afetch pkg_info: not found \\`-______,----__ \\ __,---`_ USER polluks \\ `.____ OS NetBSD \\-______,----`- KERNEL 9.3 \\ UPTIME 0h 0m \\ SHELL zsh \\ PKGS 0
Do you manage packages using pkgsrc or binary packages using pkgin?
pkgin and pkgsrc both are optional, but I'm not sure why your pkg_info is missing there (as the error suggests).
Anyway, if pkg_info isn't there but pkgin is, then pkgin list | wc -l should fallback to.
For now, you can use vmstat, (e.g. mem_free=$(($(vmstat | awk 'NR==3 {print $4}') / 1024)))
If you could PR that for NetBSD that'd be great. I know next to nothing about NetBSD, even my FreeBSD/OpenBSD skills are very rudimentary.
I'm using zsh and have access to pkgconf and pkgdata.
At least echo $(($(vmstat | awk 'NR==3 {print $4}') / 1024)) works.
For now, you can use vmstat, (e.g. mem_free=$(($(vmstat | awk 'NR==3 {print $4}') / 1024)))
If you could PR that for NetBSD that'd be great. I know next to nothing about NetBSD, even my FreeBSD/OpenBSD skills are very rudimentary.
Here's one #48
I'm using zsh and have access to pkgconf and pkgdata. At least
echo $(($(vmstat | awk 'NR==3 {print $4}') / 1024))works.
pkgconf isn't a "package" manager so isn't really relevant to this source. You've to use pkgin or pkg_info to query packages.