diff --git a/.functions b/.functions index 8a2193d..d4cd76e 100644 --- a/.functions +++ b/.functions @@ -29,3 +29,30 @@ env_ini() { echo $property | sed s'/"//g' | awk -F'=' '{print "export "$1"="$2}' done } + + +replace_variables() { + + SCRIPT_DIR=${1:-${PWD}} + + if [ ! -d "$SCRIPT_DIR" ]; then + echo "$SCRIPT_DIR is not a directory" + return + fi + + # Replace + find "${SCRIPT_DIR}" -type f -exec sed -i -e "s//$USER_ID/g" {} \; + + # Replace + find "${SCRIPT_DIR}" -type f -exec sed -i -e "s//$ANIMAL/g" {} \; + + # Replace + find "${SCRIPT_DIR}" -type f -exec sed -i -e "s//$HOST_IP/g" {} \; + + # Replace + find "${SCRIPT_DIR}" -type f -exec sed -i -e "s//$ENVIRONMENT/g" {} \; + + # Replace + find "${SCRIPT_DIR}" -type f -exec sed -i -e "s//$DOMAIN/g" {} \; + +}