Skip to content

Instantly share code, notes, and snippets.

@pathawks
Last active August 29, 2015 14:09
Show Gist options
  • Save pathawks/6bfd44a23d45e08f5a01 to your computer and use it in GitHub Desktop.
Save pathawks/6bfd44a23d45e08f5a01 to your computer and use it in GitHub Desktop.
Git.io Short URLs from Command Line
#!/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