Skip to content

Instantly share code, notes, and snippets.

@andreasonny83
Created October 19, 2017 14:04
Show Gist options
  • Save andreasonny83/852c4ac39697e3b1b2741f73ab52e8ac to your computer and use it in GitHub Desktop.
Save andreasonny83/852c4ac39697e3b1b2741f73ab52e8ac to your computer and use it in GitHub Desktop.
Rename *.dev.ts to .ts
#!/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