On Mon, Oct 16, 2006 at 09:41:04AM +0200, Binand Sethumadhavan wrote:
1. From your setup script:Very sorry, I meant to remove it. Honestly!
echo "Copying image files........."
sleep 1
\cp anniv.png ${HOME}/.aeg
That is the Microsoft way of doing things :) Why do you have that sleep
there?
Oh yes, I know mktemp but forgot. I could put that change in but I am not too
2. Your aeg script has a race condition; on multiuser systems with
malicious users, this can lead to arbitrary files owned by the user
running AEG to be wiped out. mktemp(1) is the safe way of creating
temporary files.
There is a reason. :-)
3. You don't seem to be using the fourth field of your events file
anywhere. In fact, it is identical to the fifth field.
How? Can you give a code sample? I guess I get what you are saying but some
4. All your lines which goes "| cut -d '|' ..." can be replaced far
cleaner with the bash inbuilt command "set".
Binand,
The trick in writing good shell scripts is to use bash builtins more
and external commands less, for maximum efficiency. For example, your
loop:
while [ $lines -ne 0 ]; do line=`sed -n ${lines}p $file`; do_stuff
$line; lines=`expr $lines - 1`; done
can be rewritten as
while read line; do do_stuff $line; done < $file
and you have eliminated the external sed & expr program invocations
and also the need for your $lines variable.