Created
November 4, 2009 16:35
-
-
Save rkumar/226180 to your computer and use it in GitHub Desktop.
paste a sig into a sig file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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