Revision: 30876
Updated Code
at September 3, 2010 03:29 by ksaver
Updated Code
#! /usr/bin/env bash
# ur1ca.sh
# Shorten a long URL from bash command line,
# using ur1.ca open source service.
# ksaver (at identi.ca), Aug 2010.
# Public Domain Code.
# No warranty at all.
function _curl()
{
/usr/bin/env curl -s -A 'Mozilla' "$@"
}
function html_txt()
{
read string
echo "$string" |sed -e 's/<[^>]*>//g'
}
function usage()
{
prname=$(basename $0)
echo -e "\tUsage: $prname <long-url>"
echo -e "\tExamp: $prname http://www.google.com/search?q=bash+scripting"
}
function _main_()
{
if [ -z "$1" ]
then
usage
exit
else
UR1='http://ur1.ca/'
LONG="$1"
_curl -s "$UR1" -d"longurl=$LONG" |grep -i 'Your ur1 is' |html_txt
echo
fi
}
## Run script...
_main_ "$@"
Revision: 30875
Updated Code
at August 28, 2010 02:29 by ksaver
Updated Code
#! /usr/bin/env bash
# ur1ca.sh
# Shorten a long URL from bash command line,
# using ur1.ca open source service.
# ksaver (at identi.ca), Aug 2010.
# Public Domain Code.
# No warranty at all.
function _curl()
{
/usr/bin/env curl -s -A 'Mozilla' "$@"
}
function html_txt()
{
read string
echo "$string" |sed -e 's/<[^>]*>//g'
}
function usage()
{
echo -e "\tUsage: $0 [long-url]"
echo -e "\tExamp: $0 http://www.google.com/search?q=bash+scripting"
}
function __main__()
{
if [ -z "$1" ]
then
usage
exit
else
UR1='http://ur1.ca/'
LONG="$1"
_curl -s "$UR1" -d"longurl=$LONG" |grep -i 'Your ur1 is' |html_txt
fi
}
## Run script...
__main__ "$@"
Revision: 30874
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 24, 2010 17:55 by ksaver
Initial Code
#! /usr/bin/env bash
# Short a long URL from bash command line,
# using ur1.ca open source service.
# ksaver (at identi.ca), Aug 2010.
# Public Domain Code.
# No warranty at all.
function _curl()
{
/usr/bin/env curl -s -A 'Mozilla' "$@"
}
function html_txt()
{
read string
echo "$string" |sed -e 's/<[^>]*>//g'
}
function usage()
{
echo -e "\tUsage: $0 [long-url]"
echo -e "\tExamp: $0 http://www.google.com/search?q=bash+scripting"
}
function __main__()
{
if [ -z "$1" ]
then
usage
exit
else
UR1='http://ur1.ca/'
LONG="$1"
_curl -s "$UR1" -d"longurl=$LONG" |grep -i 'Your ur1 is' |html_txt
fi
}
## Run script...
__main__ "$@"
Initial URL
http://identi.ca/ksaver
Initial Description
Usage example:\\r\\n$./ur1ca.sh \\\"http://www.google.com/search?q=bash+scripting\\\"\\r\\nYour ur1 is: http://ur1.ca/17xpn\\r\\n$
Initial Title
Shorten a long URL from bash command line
Initial Tags
url, Bash
Initial Language
Bash