SIGNIFICANT BITS

by Sean N. Henderson

TIPS AND TRICKS FOR WORKING AT THE SHELL

The last couple articles I mentioned the email program 'pine' and also a to-do list program called 'todo' (packaged under 'devtodo'). Let's explore a little bit about how to put these together, and also explore the power of the command-line.

To list out our todo list, merely type 'todo' at the shell. (The 'shell' is what UNIX users call the command prompt.) If your list has nothing, you can add some items by typing in 'todo --add', then answering the request for a description and priority. You could do it on one line also like 'todo -p 3 --add Wash car'.

So, after about a dozen or so entries, you decide that you'd like to send your wife the list and see if there's anything she'd like to add. This is simple - type 'todo | pine dearwife@yahoo.com'. Fill in the subject, write a little introductory note, then send.

You boss wants to know what you're working on. While while your boss is not on your UNIX system, you keep your todo there anyway, slyly using the 'alias' command to ask 'todo' to look at another list. Let's say 'csh' is your shell of choice (there are many). In your C-shell startup file '~/.cshrc', you put the line "alias todow 'todo --database ~/.todo_work'". Your boss wants to see it on the web, so you change the path from '~/.todo_work' to your webpage directory - something like '~/public-html/.todo_work'. And here's a little CGI wrapper to put around it.

#!/bin/ksh
# comment: filename is 'work_todo.cgi' or similar.
ptitle="TO-DO List" #var

cat <<! #here-doc
Content-type: text/html

<HTML><HEAD><TITLE>${ptitle}</TITLE>
</HEAD><BODY><H1>${ptitle}</H1><PRE>
!
todo --database ./.todo_work #actual program
cat <<! #here-doc
</PRE> </BODY> </HTML>
!
exit

Excellent! Depending on your tastes for HTML, you can dress the above however you'd like using a CSS file or more detailed tags. Also, the line with 'todo' can be modified to include more verbose output about when tasks were completed and so on.



DacsGear!
Mugs and more, visit CafePress to order
 
 
© Danbury Area Computer Society, Inc. All Rights Reserved.
Web Site Terms & Conditions of Use