From 416257f85761e36cabd1d46578abf7b05f9a1e2a Mon Sep 17 00:00:00 2001 From: LAN-TW Date: Sun, 1 Dec 2013 00:29:04 +0800 Subject: bash_include: 用 $OSTYPE 取代 uname MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bash_include | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'bash_include') diff --git a/bash_include b/bash_include index b7510a7..21fd293 100644 --- a/bash_include +++ b/bash_include @@ -1031,7 +1031,7 @@ if [ -f ~/.bash_include ]; then . ~/.bash_include fi EOF - if [ "`uname`" = "FreeBSD" ]; then + if [[ "$OSTYPE" == *freebsd* ]]; then cat >> ~/.bash_login << "EOF" GET_TTY_NAME=`tty | cut -c 9` [ "$GET_TTY_NAME" = 'v' ] && echo "Login from local virtual terminal: `tty`" @@ -1264,8 +1264,8 @@ function keep_sudo_credential () function get_memory_info () { - case "`uname`" in - "Linux"|"GNU") + case "$OSTYPE" in + *linux*|*gnu*) local meminfoline="`free -m | command grep -i mem`" local swapinfoline="`free -m | command grep -i swap`" local memtotal="`echo "$meminfoline" | awk '{print $2}'`" @@ -1287,7 +1287,7 @@ function get_memory_info () echo "Swap: $swapused / $swaptotal MB (`printf %2d $(($swapused*100/$swaptotal))`%)" fi ;; - "FreeBSD") + *freebsd*) local mempagesize="`sysctl -n hw.pagesize`" local mempagecount="`sysctl -n hw.availpages`" local memactive="`sysctl -n vm.stats.vm.v_active_count`" -- cgit