From 4488314f7894e0008601b7e0a047eb9187b0760e Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 25 Sep 2019 08:53:47 +0300 Subject: [PATCH] pfetch: fix bash 3.2 error --- pfetch | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pfetch b/pfetch index 4735197..63c2de8 100755 --- a/pfetch +++ b/pfetch @@ -223,7 +223,16 @@ get_pkgs() { # The output from this is then piped to 'wc -l' to count each # line, giving us the total package count of whatever package # managers are installed. - packages=$( + # + # Backticks are *required* here as '/bin/sh' on macOS is + # 'bash 3.2' and it can't handle the following: + # + # var=$( + # code here + # ) + # + # shellcheck disable=2006 + packages=` case $os in Linux*) # Commands which print packages one per line. @@ -267,7 +276,7 @@ get_pkgs() { command -v pkg_info && pkg_info ;; esac | wc -l - ) + ` log pkgs "$packages" >&6 }