Hardware Reference
In-Depth Information
That in turn invokes a script:
$MINBASE/conf/exec/cdplayer/play
This play script can then perform any imaginable task, such as tweeting the currently playing track or using
another command (like say ) to announce “Good night” when the bedroom light is turned out. It is for these reasons
that a simple log file is not enough. Although, naturally, monexec can also log commands, too.
TODO: A Worked Example
To cement these ideas, you are going to be the brand new writer of a brand new module! It will be the TODO
application and will be a fully worked example consisting of a Bearskin command, output conduit, messaging system,
and web applet. The design is such that when someone performs the following:
todo add steev "Take out the rubbish"
the message will be added to the list of tasks in steev's area and will be available for review on a web page or at the
command line, with this:
todo list steev
This output could even be piped through Festival as part of the alarm call in the morning!
So to begin, you need to create a file such as $MINBASE/bin/todo and process the basic arguments:
#!/bin/bash
MINBASE=/usr/local/minerva
CMD=$1; shift
USER=$1; shift
MSG=$*
TODOFILE=$MINBASE/etc/users/$USER/todolist
if [ "$CMD" == "add" ]; then
date +"%Y-%m-%d $MSG" >> $TODOFILE
fi
if [ -f $TODOFILE ]; then
if [ "$CMD" == "list" ]; then
cat $TODOFILE
elif [ "$CMD" == "clear" ]; then
rm $TODOFILE
fi
fi
You then need to ensure the script is executable with this and test it for a little while:
chmod ugo+x todo
(It's okay—I've done the testing step for you!)
Search WWH ::




Custom Search