Created
September 27, 2017 14:07
-
-
Save glenndevenish/2da7e0329c40a31a5cde19fa57eacbdd to your computer and use it in GitHub Desktop.
Insert version number before the file 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 | |
if [[ $# -eq 0 ]] ; then | |
echo "Please enter the version number"; | |
exit 0; | |
fi | |
echo "using version number:" $1; | |
shopt -s globstar; | |
rename "s/\..*\./\./" **; | |
rename "s/\.*\./\.$1\./" **; | |
mv "index.$1.html" "index.html"; | |
mv "script.$1.sh" "script.sh"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Requires >bash 4.0, rename (a perl script) and globstar support