Quote:
Originally Posted by Barry-xlovecam
Works Good
Had to install curl
Try Link 
|
should have added a curl check.
here is the updated code
Code:
#!/bin/bash
# goo.gl link creator and decoder
case "$1" in
create)
if [ $# -ne 2 ]
then
echo "url to shorten needed."
exit
fi
curl -s -d "url=${2}" http://goo.gl/api/url | sed -n "s/.*:\"\([^\"]*\).*/\1/p";
;;
decode)
if [ $# -ne 2 ]
then
echo "url to decode needed"
exit
fi
check=$(echo $2 | sed -n 's/.*\(http:\/\/goo.gl\/[A-Za-z0-9][A-Za-z0-9]*\).*/\1/p');
if [ -n "$(echo $check)" ]; then
curl -sI $2 | sed -n 's/Location:.* //p';
else
echo "you must give a valid goo.gl link"
fi
;;
*)
if which curl >/dev/null; then
echo "Usage: `basename $0` {create|decode}" >&2
else
echo "curl missing from your system, please install it";
fi
exit 64
;;
esac
