Created
January 27, 2015 15:10
-
-
Save wesleyit/a509356c4c3fa5176887 to your computer and use it in GitHub Desktop.
This script will expand variables inside a file and generate a new file with the same name, but without the ".sh" extension.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ########################################################## | |
# parse_shell_infile.sh | |
# This script will expand variables inside a file | |
# and generate a new file with the same name, but | |
# without the ".sh" extension. | |
# Wesley Rodrigues da Silva <wesley.it at gmail.com> | |
# LICENCE CREATIVE COMMONS BY - 2014 | |
# http://creativecommons.org/licenses/by/2.0/legalcode | |
# ########################################################## | |
IN="$1" | |
OUT="${IN/.sh/}" | |
echo "Criando o arquivo $OUT a partir do template $IN..." | |
CODE=$(eval "echo \"$(cat $IN)\"") | |
echo "$CODE" > $OUT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment