diff options
author | LAN-TW <lantw44@gmail.com> | 2013-12-01 00:29:04 +0800 |
---|---|---|
committer | LAN-TW <lantw44@gmail.com> | 2013-12-01 00:29:04 +0800 |
commit | 416257f85761e36cabd1d46578abf7b05f9a1e2a (patch) | |
tree | 865e48c758c66540ed45c9a94be8c95adb20c976 /bash_include | |
parent | d8930900ce078b21b2d4e7a5387b6c33f6f6aa04 (diff) | |
download | configfile-416257f85761e36cabd1d46578abf7b05f9a1e2a.tar.gz configfile-416257f85761e36cabd1d46578abf7b05f9a1e2a.tar.zst configfile-416257f85761e36cabd1d46578abf7b05f9a1e2a.zip |
bash_include: 用 $OSTYPE 取代 unamebash_include-20131131
Diffstat (limited to 'bash_include')
-rw-r--r-- | bash_include | 8 |
1 files changed, 4 insertions, 4 deletions
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`" |