Skip to content

Instantly share code, notes, and snippets.

@tundeaoni
Last active April 21, 2017 15:27
Show Gist options
  • Save tundeaoni/18033ec7c21c56c6708731a029efc761 to your computer and use it in GitHub Desktop.
Save tundeaoni/18033ec7c21c56c6708731a029efc761 to your computer and use it in GitHub Desktop.
Replace handlebars with env values
# !/bin/bash
if [[ -z "$1" ]]
then
echo "docker file needs to be specified";
fi
perl -p -e 's/\%([^%]+)\%/defined $ENV{$1} ? $ENV{$1} : "\${$1}"/eg' $1 > test
cat test
@BrainMaestro
Copy link

you can use substitution to cat the entire perl command. Or pipe it to less

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment