ToxicCode     =Home= / =Config Files= / =Shell Scripts= / =Articles= / =Text Files= / =Misc= /

Register | Login | Submit new shell script

Title: tinify
Submitted by: Fingel on 2009-03-16
Function: Make a URL tiny

#!/bin/sh
#
# title: tinify
# author: Philip Stark
# desc:  pass an url as the first and only argument to make it tiny or 
#        leave it away and it takes the content of the clipboard by
#        calling xclip. 
# licenced under the WTFPL (http://sam.zoy.org/wtfpl/)
 
if [ "$1" = "" ]; then
  tinyurl=$(curl http://tinyurl.com/api-create.php?url=$(xclip -selection clipboard -o) 2> /dev/null)
  echo $tinyurl;
  echo $tinyurl | xclip -selection clipboard -i;
else
  url=$1;
  tinyurl=$(curl http://tinyurl.com/api-create.php?url=${url} 2> /dev/null)
  echo $tinyurl;
  echo $tinyurl | xclip -selection clipboard -i;
fi



Comments



Nothing Copyrighted