From af2b6d65274ba3670a093f37cec4352b535a7969 Mon Sep 17 00:00:00 2001 From: kakashitheaf Date: Tue, 30 Dec 2014 02:02:27 +0800 Subject: [PATCH] use only one startproject.sh --- linux.startproject.sh | 19 ------------------- osx.startproject.sh => startproject.sh | 10 +++++++++- 2 files changed, 9 insertions(+), 20 deletions(-) delete mode 100755 linux.startproject.sh rename osx.startproject.sh => startproject.sh (51%) diff --git a/linux.startproject.sh b/linux.startproject.sh deleted file mode 100755 index e440159..0000000 --- a/linux.startproject.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -set -e - -function usage { - echo "\n usage:\n ./startproject.sh \n" -} - -if [ "$1" == "" ]; then - usage - exit -fi - -echo "Starting project $1." - -cp -r template $1 -find $1 -type f | xargs sed -i "s/template/$1/" -mv $1/template $1/$1 - -echo "Create $1 succeed!" diff --git a/osx.startproject.sh b/startproject.sh similarity index 51% rename from osx.startproject.sh rename to startproject.sh index 8c8e174..2c46a53 100755 --- a/osx.startproject.sh +++ b/startproject.sh @@ -5,11 +5,19 @@ function usage { echo "\n usage:\n ./startproject.sh \n" } -if [ "$1" == "" ]; then +if [ "$1"X == ""X ]; then usage exit fi +if [ "$(uname)" == "Darwin" ]; then + alias sed='sed -i' +elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then + echo `uname -s` +elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then + echo `uname -s` +fi + echo "Starting project $1." cp -r template $1