I decided to create a very quick and dirty note keeping utility.... no gui, no menu interface.
Here is the code....
Code:
#! /bin/sh
# File: notes
# Description: Simple Note keeping script.
# Alias to "n" # alias n='sh /home/crouse/scripts/notes.sh'
# USAGE EXAMPLES:
#n a "This is a note" (adds the line enclosed in quotes)
#n d 2 (removes line 2)
#n l (lists all lines)
#n s EXPRESSION (searchs for EXPRESSION)
# Options: a=add d=delete (or r=remove) l=listall s=search
# Set your paths below - next 2 lines
FILEPATH="/home/crouse"
FILE="notes.txt"
touch ${FILEPATH}/${FILE}
if [ "$1" = "a" ] ; then
echo $2 >> ${FILEPATH}/${FILE}
fi
if [ "$1" = "s" ] ; then
grep -i "$2" ${FILEPATH}/${FILE} | less
fi
if [ "$1" = "d" ] || [ "$1" = "r" ] ; then
numberoflines=`less ${FILEPATH}/${FILE} | wc -l`
bottompartoffile=`echo $((${numberoflines}-${2}))`
headvar=`echo $((${2}-1))`
head -n ${headvar} ${FILEPATH}/${FILE} > /tmp/notes
tail -n ${bottompartoffile} ${FILEPATH}/${FILE} >> /tmp/notes
mv /tmp/notes ${FILEPATH}/${FILE}
fi
if [ "$1" = "l" ] ; then
nl ${FILEPATH}/${FILE} | less
fi
if [ "$1" = "clear" ] ; then
rm -f ${FILEPATH}/${FILE} #removes ALL NOTES !!
fi
exit 0
To add someting to the file.....
Code:
[15:39:51 crouse]$ n a "This is a note"
To search the file
Code:
[15:42:49 crouse]$ n s "note"
To list ALL notes
Code:
[15:43:37 crouse]$ n l
To delete/remove a line..... (view all.... REMEMBER the LINE NUMBER

)
Code:
[15:43:37 crouse]$ n r 1
Simple but effective...