Skip to content

Instantly share code, notes, and snippets.

View ekarudianto's full-sized avatar
💻
Typing ...

Eka Rudianto ekarudianto

💻
Typing ...
View GitHub Profile
@ekarudianto
ekarudianto / bump_version.sh
Created May 27, 2019 13:09 — forked from andyexeter/bump_version.sh
Bash script to increment version numbers in multiple files
#!/usr/bin/env bash
# Usage: ./bump_version.sh <major|minor|patch> - Increments the relevant version part by one.
#
# Usage 2: ./bump_version.sh <version-from> <version-to>
# e.g: ./bump_version.sh 1.1.1 2.0
set -e
# Define which files to update and the pattern to look for
URL="http://stackoverflow.com/"
# store the whole response with the status at the and
HTTP_RESPONSE=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" -X POST $URL)
# extract the body
HTTP_BODY=$(echo $HTTP_RESPONSE | sed -e 's/HTTPSTATUS\:.*//g')
# extract the status
HTTP_STATUS=$(echo $HTTP_RESPONSE | tr -d '\n' | sed -e 's/.*HTTPSTATUS://')