init
This commit is contained in:
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
|
||||
_openbsd() {
|
||||
TOTAL="$(free | awk '/^Mem:/ {print $2}')"
|
||||
MUSED="$(top -b -n 1 | grep -o 'Real.*' | sed 's/Real: //' | sed 's/\/.*//')"
|
||||
printf "$MUSED" | egrep "[0-9]{4}" > /dev/null && FUSED="$(printf "$MUSED" | cut -c -2 | sed 's/./.&/2')G" || FUSED=$MUSED
|
||||
printf "$FUSED/$TOTAL\n"
|
||||
}
|
||||
|
||||
_freebsd() {
|
||||
TOTAL="$(freecolor -om | awk '/^Mem:/ {print $2}')"
|
||||
MUSED="$(freecolor -om | awk '/^Mem:/ {print $3}')"
|
||||
printf "$MUSED" | egrep "[0-9]{4}" > /dev/null && FUSED="$(printf "$MUSED" | cut -c -2 | sed 's/./.&/2')G" || FUSED=""$MUSED"M"
|
||||
printf "$TOTAL" | egrep "[0-9]{4}" > /dev/null && TOTAL="$(printf "$TOTAL" | cut -c -2 | sed 's/./.&/2')G" || FUSED=$TOTAL
|
||||
printf "$FUSED/$TOTAL\n"
|
||||
}
|
||||
|
||||
_linux() {
|
||||
MUSED="$(free -m | awk '/^Mem:/ {print $3}')"
|
||||
echo "$MUSED"
|
||||
}
|
||||
|
||||
case $(uname) in
|
||||
Linux) _linux ;;
|
||||
OpenBSD) _openbsd ;;
|
||||
FreeBSD) _freebsd ;;
|
||||
esac
|
||||
Reference in New Issue
Block a user