Neofetch: Use `$HOSTTYPE` to get the architecture instead of `uname`

Created on 30 May 2018  路  8Comments  路  Source: dylanaraps/neofetch

  • This is faster.
  • This should work on all systems.
  • I need some help testing all of these.

TODO:

  • [ ] Testing

    • [x] Linux

    • [ ] BSD

    • [x] macOS

    • [ ] iOS

    • [ ] Windows

    • [ ] Others

Testing:

bash -c 'echo $HOSTTYPE'
Enhancement Help Wanted

All 8 comments

Result for openSUSE Leap 15.0:

bash -c 'echo $HOSTTYPE'
x86_64

uname -a
Linux leap15-pc 4.12.14-lp150.12.4-default #1 SMP Tue May 22 05:17:22 UTC 2018 (66b2eda) x86_64 x86_64 x86_64 GNU/Linux

It should work in any system with proper host detection when one configures a bash installation through ./configure. See https://lists.gnu.org/archive/html/bug-bash/2008-07/msg00038.html

Also, Solaris and AIX returns the correct architecture (sparc and powerpc respectively).

Would you say it鈥檚 safe to use instead of uname?

AFAIC bash won't even compile without proper --host/--build setting in its ./configure so it should be safe.

Done.

Result for GhostBSD (live CD)

bash -c 'echo $HOSTTYPE'
FreeBSD

uname -m
amd64

Gah

I'll fix this.

Fixed.

I've reverted it back to using uname but I've added -m to the cache_uname function so we still save a subprocess. :woman_shrugging:

Was this page helpful?
0 / 5 - 0 ratings