Skip to content

Instantly share code, notes, and snippets.

@rkumar
Created November 4, 2009 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rkumar/226180 to your computer and use it in GitHub Desktop.
Save rkumar/226180 to your computer and use it in GitHub Desktop.
paste a sig into a sig file
#!/bin/bash
#*******************************************************#
# #
# #
# Arunachalesha #
# $Id$ #
#*******************************************************#
file="$HOME/myblogs/totalrecall/techurls.txt"
sig=`pbpaste`
if [ "$sig" == "" ]
then
echo "Got nothing! Maybe pbpaste not working. Please paste manually:"
read sig
fi
str="$sig"
count=`echo "$sig" | grep -c "^http:"`
if [ $count -eq 1 ]
then
echo "Enter an html title:"
read title
if [ "$title" != "" ]
then
str="<a href=\"$sig\">$title</a>"
fi
else
count=`echo "$sig" | grep -c "http:"`
if [ $count -eq 0 ]
then
echo "No URL found. Would you like to add a URL (blank to ignore)?"
read url
if [ "$url" != "" ]
then
str="<a href=\"$url\">$str</a>"
fi
fi
fi
echo "Got: $str"
echo "Add a remark? (Blank to ignore): "
read remark
if [ "$remark" != "" ]
then
str="$remark : $str"
fi
echo "$str" >> $file
echo "Added [ $str ] to $file"
echo "----------------------"
tail $file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment