Skip to content

Instantly share code, notes, and snippets.

@saggiyogesh
Created August 25, 2019 15:28
Show Gist options
  • Save saggiyogesh/c688e0c8f59399d39cd2611ae5854eec to your computer and use it in GitHub Desktop.
Save saggiyogesh/c688e0c8f59399d39cd2611ae5854eec to your computer and use it in GitHub Desktop.
Bash script to increment no in file name
#!/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