Created
October 24, 2019 12:45
-
-
Save CreatiCoding/2fc68094be47ccb4d504190381311aa3 to your computer and use it in GitHub Desktop.
shell script programming
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| uname_out="$(uname -s)" | |
| case "${uname_out}" in | |
| Linux*) machine=Linux;; | |
| Darwin*) machine=Mac;; | |
| CYGWIN*) machine=Cygwin;; | |
| MINGW*) machine=MinGw;; | |
| *) machine="UNKNOWN:${uname_out}" | |
| esac | |
| flag=0 | |
| if [ "$1" = "development" ]; then flag=1; fi | |
| if [ "$1" = "testing" ]; then flag=1; fi | |
| if [ "$1" = "production" ]; then flag=1; fi | |
| if [ $flag != 1 ]; then | |
| echo "env error! type only development or testing or production" | |
| exit -1; | |
| fi | |
| ./file/exec.py $1 | |
| mv .envrc .envrc.bk | |
| cp ./file/envrc.env .envrc | |
| # creco: Mac, Linux 별로 sed 명령어의 옵션 기능이 달라 분기 처리가 필요 | |
| if [ "$machine" = "Mac" ]; then | |
| sed -i "" 's/^/export /g' .envrc; | |
| fi | |
| if [ "$machine" = "Linux" ]; then | |
| sed -i 's/^/export /g' .envrc; | |
| fi | |
| direnv allow |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment