Last active
August 29, 2015 14:09
-
-
Save pathawks/6bfd44a23d45e08f5a01 to your computer and use it in GitHub Desktop.
Git.io Short URLs from Command Line
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
#!/bin/sh | |
if [ "$#" -eq 2 ]; then | |
curl -i http://git.io -F "url=$1" -F "code=$2" 2>/dev/null | grep 'Location' | sed 's/.*: //' | |
elif [ "$#" -eq 1 ]; then | |
curl -i http://git.io -F "url=$1" 2>/dev/null | grep 'Location' | sed 's/.*: //' | |
else | |
echo "Syntax error" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment