From 9feb14caa5e2471f6f2503dcceaf5d5ad99ff7f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Mengu=C3=A9?= Date: Thu, 16 Aug 2012 00:22:49 +0200 Subject: [PATCH] Fix _lp_CPUNUM on Linux when 'nproc' is missing On Linux, hide the "command not found" message on Linux when 'nproc' is missing and the grep fallback is used. (nproc doesn't exist on Debian Lenny, see issue #31 and #36) --- liquidprompt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/liquidprompt b/liquidprompt index 4093329..22d0b3b 100755 --- a/liquidprompt +++ b/liquidprompt @@ -146,7 +146,7 @@ fi # Get cpu count case "$LP_OS" in - Linux) _lp_CPUNUM=$( nproc || grep -c '^[Pp]rocessor' /proc/cpuinfo ) ;; + Linux) _lp_CPUNUM=$( nproc 2>/dev/null || grep -c '^[Pp]rocessor' /proc/cpuinfo ) ;; FreeBSD) _lp_CPUNUM=$( sysctl -n hw.ncpu ) ;; SunOS) _lp_CPUNUM=$( kstat -m cpu_info | grep -c "module: cpu_info" ) ;; esac