Merge pull request #8 from LudovicRousseau/master
Add Darwin (Mac OS X) support Do not fail if screen(1) is not installed
This commit is contained in:
commit
f4135f142e
@ -74,6 +74,7 @@ OS="Linux"
|
|||||||
case $(uname) in
|
case $(uname) in
|
||||||
"Linux" ) OS="Linux" ;;
|
"Linux" ) OS="Linux" ;;
|
||||||
"FreeBSD") OS="FreeBSD" ;;
|
"FreeBSD") OS="FreeBSD" ;;
|
||||||
|
"Darwin") OS="Darwin" ;;
|
||||||
"DragonFly") OS="FreeBSD" ;;
|
"DragonFly") OS="FreeBSD" ;;
|
||||||
"SunOS") OS="SunOS" ;;
|
"SunOS") OS="SunOS" ;;
|
||||||
esac
|
esac
|
||||||
@ -152,6 +153,11 @@ __cpunum_FreeBSD()
|
|||||||
sysctl -n hw.ncpu
|
sysctl -n hw.ncpu
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__cpunum_Darwin()
|
||||||
|
{
|
||||||
|
__cpunum_FreeBSD
|
||||||
|
}
|
||||||
|
|
||||||
__cpunum_SunOS()
|
__cpunum_SunOS()
|
||||||
{
|
{
|
||||||
kstat -m cpu_info | grep "module: cpu_info" | wc -l
|
kstat -m cpu_info | grep "module: cpu_info" | wc -l
|
||||||
@ -174,6 +180,11 @@ __load_FreeBSD()
|
|||||||
echo -n "$load"
|
echo -n "$load"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__load_Darwin()
|
||||||
|
{
|
||||||
|
__load_FreeBSD
|
||||||
|
}
|
||||||
|
|
||||||
__load_SunOS()
|
__load_SunOS()
|
||||||
{
|
{
|
||||||
load=$(LANG=C uptime | awk '{print $10}'| sed -e 's/,//')
|
load=$(LANG=C uptime | awk '{print $10}'| sed -e 's/,//')
|
||||||
@ -365,7 +376,7 @@ __jobcount_color()
|
|||||||
{
|
{
|
||||||
local running=$(jobs -r | wc -l | tr -d " ")
|
local running=$(jobs -r | wc -l | tr -d " ")
|
||||||
local stopped=$(jobs -s | 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
|
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}"
|
rep="${NO_COL}${YELLOW}${screens}s${NO_COL}/${YELLOW}${running}r${NO_COL}/${LIGHT_YELLOW}${stopped}t${NO_COL}"
|
||||||
|
Loading…
Reference in New Issue
Block a user