Skip to content

Instantly share code, notes, and snippets.

@vitalk
Created July 22, 2014 20:12
Show Gist options
  • Save vitalk/c0e802f485d13e3d8ec9 to your computer and use it in GitHub Desktop.
Save vitalk/c0e802f485d13e3d8ec9 to your computer and use it in GitHub Desktop.
Bump new version
#!/usr/bin/env bash
#
#: usage: bump <version> <upcoming>
#:
#: For each file in current directory and subdirectories
#: update any <version> string to the new <upcoming> value.
function help() {
sed -En 's/^#:[[:space:]]?//p' $0
}
if [[ $# -ne 2 ]]; then
help && exit;
fi
version=$1
next_version=$2
egrep -r --exclude-dir "node_modules" -l "[\"']$version[\"']" * | \
xargs sed -i "" "s/$version/$next_version/g"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment