host: fix sysctl adding newlines to output
This commit is contained in:
parent
f4e9f3b4ca
commit
4157b94228
13
pfetch
13
pfetch
|
@ -217,7 +217,18 @@ get_host() {
|
|||
;;
|
||||
|
||||
*BSD*)
|
||||
host=$(sysctl -n hw.vendor hw.product)
|
||||
# Use 'set --' to store the output of the command
|
||||
# as it normalizes whitespace and strips newlines.
|
||||
#
|
||||
# Disable the shellcheck warning for word-splitting
|
||||
# as it's safe and intended ('set -f' disables globbing).
|
||||
# shellcheck disable=2046
|
||||
{
|
||||
set -f
|
||||
set +f -- $(sysctl -n hw.vendor hw.product)
|
||||
}
|
||||
|
||||
host=$*
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user