Created
August 25, 2019 15:28
-
-
Save saggiyogesh/c688e0c8f59399d39cd2611ae5854eec to your computer and use it in GitHub Desktop.
Bash script to increment no in file name
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
#!/usr/bin/env bash | |
set -e | |
# find existing version of static.zip | |
cd ios; | |
name=$(ls | grep static) | |
echo 'grep name: '$name | |
## remove existing static zip file | |
rm $name | |
## remove static | |
name=${name:7} | |
echo 'remove static: '$name | |
## remove .zip | |
i=${name:0:${#name}-4} | |
echo "version no:" $i | |
((i++)); | |
echo "increment no: "$i | |
name=static-$i | |
echo $name | |
cd .. | |
echo 'Zipping static to iOS' | |
zip -r ios/$name static |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment