fixed Replace bug

This commit is contained in:
rallets 2017-12-04 16:01:42 +08:00
parent 5931e2067b
commit 6d05b126c0

View File

@ -91,13 +91,13 @@ function docker_rm_all() {
docker rm -f `docker ps --no-trunc -aq` docker rm -f `docker ps --no-trunc -aq`
} }
function Replace () { function Replace () {
if [ "$(uname)" == "Darwin" ]; then if [[ "$(uname)" == "Darwin" ]]; then
if [ "$#" -eq 3 ]; then if [ "$#" -eq 3 ]; then
ag $2 -l -G $1 | xargs sed -i '' s/$2/$3/g ag $2 -l -G $1 | xargs sed -i '' s/$2/$3/g
elif [ "$#" -eq 2 ]; then elif [ "$#" -eq 2 ]; then
ag $1 -l | xargs sed -i '' s/$1/$2/g ag $1 -l | xargs sed -i '' s/$1/$2/g
fi fi
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then elif [[ "$(expr substr $(uname -s) 1 5)" == "Linux" ]]; then
if [ "$#" -eq 3 ]; then if [ "$#" -eq 3 ]; then
ag $2 -l -G $1 | xargs sed -i s/$2/$3/g ag $2 -l -G $1 | xargs sed -i s/$2/$3/g
elif [ "$#" -eq 2 ]; then elif [ "$#" -eq 2 ]; then