Hello blog! And todo.sh
Hello blog.
I am currently unemployed. We’ll maybe delve into that some other time. Recession.
Remember this post? Well, I’ve been modifying bands.sh to become todo.sh and to be displayed on my desktop via GeekTool. It looks something like this.
So far, I’ve basically changed it so that you can delete a numbered line like this:
‘todo -d 4′ would delete post 4. Works for me! I’ve also written it in a way so that I can add re-ordering or re-prioritizing of items in the list. When I figure out how. Hehe.
Here’s the code:
# you can change the textfile variable to anything you want
# this allows you to make various lists and have different scripts
# for each. simple but useful.
# I use it to make a list of albums I wanna get.
# THIS VERSION: has been modified to work as a TODO type script
# p.s. I killed most of the comments. Ask me if you wanna know
# what something does. Like the sed and the awk. Fuck that shit.
textfile=/Users/ryan/Documents/todo.txt #edit this line!!
filename=`basename $textfile` #short version
if [ ${#} -lt 1 ] # if you are not adding something,
then # assumes you want to see file
echo " "
echo " .:[$filename]:."
echo " " # let’s make a nice header/footer
cat -n $textfile # show the file with line numbers
echo " "
elif [ "$1" = "-d" ]
then
showline=`awk "NR==$2" $textfile`
echo "`basename $0`: Removing ‘$showline‘ from $filename…"
mv $textfile $textfile.tmp
sed "$2d" $textfile.tmp > $textfile # dumb way to do it
echo "Done!"
else
echo "$1" >> $textfile # add a task
echo "`basename $0`: added ‘$1‘ to $filename!"
fi
Damn, I found/fixed so many bugs while getting ready to post this entry. Cool, I guess.












