Created
October 19, 2017 14:04
-
-
Save andreasonny83/852c4ac39697e3b1b2741f73ab52e8ac to your computer and use it in GitHub Desktop.
Rename *.dev.ts to .ts
This file contains hidden or 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 | |
# Find and rename all the modules files according to the target environment | |
env=${1-"dev"} | |
dir="src/app/components" | |
find $dir -name "*.$env.ts" -type f | while read file | |
do | |
base=$(basename $file) | |
dirpath=$(dirname $file) | |
if test "$env" == "dev" | |
then | |
renamed=$(echo $base | sed 's/\.dev\./\./g') | |
else | |
renamed=$(echo $base | sed 's/\.prod\./\./g') | |
fi | |
echo "Renaming $base to $renamed" | |
cp $dirpath/$base $dirpath/$renamed | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment