From 03fa04a2773a2c86cab087ea52baa7306f2b37e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=9F=E9=85=8C=20=E9=B5=AC=E5=85=84?= Date: Thu, 14 May 2015 09:58:15 +0800 Subject: [PATCH] Detect dist for suiting command params --- bash/bashrc/package.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/bash/bashrc/package.sh b/bash/bashrc/package.sh index 0258e2c..de1a3d5 100644 --- a/bash/bashrc/package.sh +++ b/bash/bashrc/package.sh @@ -1,5 +1,16 @@ #!/bin/bash +case $( uname -a | awk '{ print $1 }' ) in + Darwin) # although this is deprecated, Mac still use it + PERM="+111" + ;; + Linux) ;& + CYGWIN~) ;& + *) + PERM="/111" + ;; +esac + function __func_head() { echo "Usage:" ${FUNCNAME[1]} $1 } @@ -14,7 +25,7 @@ SDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"/sources if [ -d "$SDIR" ]; then echo "Begin source:" - for i in $( find $SDIR -maxdepth 1 -type f -perm +111 | sort ) + for i in $( find $SDIR -maxdepth 1 -type f -perm $PERM | sort ) do echo " Source:" $( basename $i ) . $i