From 081316ec5c23390c897facc5e352774ed2373cc8 Mon Sep 17 00:00:00 2001 From: Ludovic Rousseau Date: Mon, 30 Jul 2012 10:41:23 +0200 Subject: [PATCH 1/2] Add Darwin (Mac OS X) support Darwin is based on FreeBSD. --- liquidprompt.bash | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/liquidprompt.bash b/liquidprompt.bash index ec2da49..3e0e8a2 100755 --- a/liquidprompt.bash +++ b/liquidprompt.bash @@ -74,6 +74,7 @@ OS="Linux" case $(uname) in "Linux" ) OS="Linux" ;; "FreeBSD") OS="FreeBSD" ;; + "Darwin") OS="Darwin" ;; "DragonFly") OS="FreeBSD" ;; "SunOS") OS="SunOS" ;; esac @@ -152,6 +153,11 @@ __cpunum_FreeBSD() sysctl -n hw.ncpu } +__cpunum_Darwin() +{ + __cpunum_FreeBSD +} + __cpunum_SunOS() { kstat -m cpu_info | grep "module: cpu_info" | wc -l @@ -174,6 +180,11 @@ __load_FreeBSD() echo -n "$load" } +__load_Darwin() +{ + __load_FreeBSD +} + __load_SunOS() { load=$(LANG=C uptime | awk '{print $10}'| sed -e 's/,//') From 99aa8e334b6adc81c2c25b0421658c137f867528 Mon Sep 17 00:00:00 2001 From: Ludovic Rousseau Date: Mon, 30 Jul 2012 11:01:04 +0200 Subject: [PATCH 2/2] Do not fail if screen(1) is not installed If screen is not present then an error message is displayed each time the prompt is displayed: -bash: screen : command not found The error message is now sent to /dev/null --- liquidprompt.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/liquidprompt.bash b/liquidprompt.bash index 3e0e8a2..b6d2591 100755 --- a/liquidprompt.bash +++ b/liquidprompt.bash @@ -376,7 +376,7 @@ __jobcount_color() { local running=$(jobs -r | wc -l | tr -d " ") local stopped=$(jobs -s | wc -l | tr -d " ") - local screens=$(screen -ls | grep -c Detach ) + local screens=$(screen -ls 2> /dev/null | grep -c Detach ) if [ $running != "0" -a $stopped != "0" -a $screens != "0" ] ; then rep="${NO_COL}${YELLOW}${screens}s${NO_COL}/${YELLOW}${running}r${NO_COL}/${LIGHT_YELLOW}${stopped}t${NO_COL}"