Get sort url from tinyurl.com


/ Published in: Bash
Save to your folder(s)

Little script which call tinyurl.com via 'curl' for generate a sort url of the url you pass.


Copy this code and paste it in your HTML
  1. #!/bin/sh
  2.  
  3. if [ -n "$1" ]; then
  4. url="$1"
  5. else
  6. echo "Error: You must pass a URL"
  7. exit
  8. fi
  9.  
  10. curl -s http://tinyurl.com/create.php?url=${url} | awk -F\" '/name=tinyurl/ {print $2}'

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.