Skip to content

Instantly share code, notes, and snippets.

@Janoyan
Last active February 10, 2021 10:12
Show Gist options
  • Save Janoyan/ce4f44c5e7f83a03ffa1bb28d62e47c1 to your computer and use it in GitHub Desktop.
Save Janoyan/ce4f44c5e7f83a03ffa1bb28d62e47c1 to your computer and use it in GitHub Desktop.
mappings=()
while IFS= read -r line; do
mappings+=("$line")
done < mappings.txt
for value in "${mappings[@]}" ; do
prefix=${value#*=};
env_path=${value%=*};
rm -f "$env_path" && for l in $(printenv | grep ^"$prefix"); do echo ${l#$prefix} >> "$env_path"; done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment