Skip to content

Commit

Permalink
reset var on exit and default to es
Browse files Browse the repository at this point in the history
  • Loading branch information
Pari Work Temp committed Aug 13, 2024
1 parent 767f03e commit 485952c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion {{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ defaults_file=$2
declare -a config_vars
declare -a merged_arr

reset_config_vars() {
unset config_vars
}
trap reset_config_vars EXIT

while IFS= read -r line; do
config_vars+=("$line")
done < <(grep -o "REPLACE_WITH_[A-Z_]*" "$config_file")
Expand All @@ -25,7 +30,7 @@ done < <(grep -o "REPLACE_WITH_[A-Z_]*" "$config_file")


for i in "${config_vars[@]}"; do
value=$(grep -o "$i=.*" "$defaults_file")
value=$(grep -o "$i=.*" "$defaults_file") || echo ""
if [[ -z $value ]]; then
echo "Skipping $i as it does not exist in $defaults_file"
continue
Expand Down

0 comments on commit 485952c

Please sign in to comment.