Posted By

Juanje on 05/14/08


Tagged

curl url tinyurl


Versions (?)

Get sort url from tinyurl.com


 / Published in: Bash
 

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

  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  

You need to login to post a comment.