Last active
August 10, 2016 15:39
-
-
Save mertcangokgoz/aac7d2d2aa028bdc0f58714fc025f292 to your computer and use it in GitHub Desktop.
Git.io: GitHub URL Shortener via console
This file contains hidden or 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 | |
set -e | |
if [[ -z "$1" ]]; | |
then | |
echo "Please enter a website url" | |
exit 1 | |
else | |
if [[ -z "$2" ]]; | |
then | |
echo "Please enter a custom url" | |
exit 1 | |
else | |
echo "Please Wait..." | |
curl -s -i https://git.io -F "url=$1" -F "code=$2" | awk '/Location/ {print $2}' | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment