diff --git a/setup/functions.sh b/setup/functions.sh index c92b886..94dcc32 100644 --- a/setup/functions.sh +++ b/setup/functions.sh @@ -116,7 +116,7 @@ home_resource_env() { # check and replace "PUBLIC_DIR=/Users/tanhongit/Data/CSlant/home-resource/public" to "PUBLIC_DIR=$HOME_RESOURCE_DIR/public" if [ -f "$HOME_FE_DIR/.env" ] && ! grep -q "PUBLIC_DIR=$HOME_RESOURCE_DIR/public" "$HOME_FE_DIR/.env"; then echo ' ∟ Setting up PUBLIC_DIR...' - sed -i '' "s|PUBLIC_DIR=.*|PUBLIC_DIR=$HOME_RESOURCE_DIR/public|g" "$HOME_FE_DIR/.env" + awk -v var="PUBLIC_DIR=$HOME_RESOURCE_DIR/public" 'BEGIN{FS=OFS="="} $1=="PUBLIC_DIR"{$2=var}1' "$HOME_FE_DIR/.env" > temp && mv temp "$HOME_FE_DIR/.env" else echo ' ∟ PUBLIC_DIR already set up...' fi