[Bashburn-info] Some more changes coming at you.
Brought to you by:
bashburn
|
From: Steven W. O. <st...@sy...> - 2008-08-29 02:44:21
|
Lots of little cleanup stuff.
Lots more reduction in the number of processes that get created.
Henceforth and forthwith, all local variables should be lower case. All
global variables should be uppercase. This is a *very* old trick I learned
on an old and now very defunct operating system that required it.
I'm finding lots of global variables that are being set when the simple
return value of a function could suffice.
I'm finding a few places where a global variable is set unconditionally
and then tested later to see if something should be done. All ripped out.
More case insensitive stuff ripped out.
All of the read commands are now read -e. Anders, I was not able to
reproduce your problem that you earlier described: " enter a number and
press backspace, the prompt gets deleted". If you still see the problem, I
will need more explicit info on how to reproduce.
I fixed the menu header problem.
is_dir_empty is now actually used all the places where it should have been
before. Also, it is now greatly simplified.
delete_data had an interesting idea
while true
do
read soemthing
if something
then
do something
break
else
do something else
break
fi
done
instead, how about
read soemthing
if something
then
do something
else
do something else
fi
Look Ma! No loops!
Here's a good one:
echo $(du -shL ${BBBURNDIR}) | cut -d ' ' -f 1
becomes
du -shL ${BBBURNDIR} | cut -d $'\t' -f 1
break or continue is wrong unless you're actually in a loop!
I see a number of things like this:
if something
then
do something
wait for enter
else
do something else
wait for enter
fi
I factored out the wait for enter. In some cases it was slightly dramatic.
Sombody should please look at what I did in audiofunc.sh in named. The
comment says
# If nothing is entered at the prompt then exit loop.
continue
I assumed the comment was wrong and not the code. It's now restructured.
Here's a good one:
if [[ "$answer" == y ]]
then
return 0
else
return 1
fi
is now
[[ "$answer" == y ]]
Remember that status is always equal to the last thing you did.
in xmmsread, I broke out a small bit of awk magic and saved a process:
done < <(grep -s [Mm][Pp]3 "${FILE}" | grep -v EXTINF)
vs
done < <(awk 'BEGIN{IGNORECASE=1} /mp3/ && !/EXTINF/' "${file}")
Guys, PLEASE look at what I've done. I'm getting lonely here and I need
you guys to keep me honest. I never make any misteaks but there's this
thing called Murphy's Ultimate corollary: If it could have gone wrong
earlier and it didn't, then it ultimately would have been beneficial for
it to have.
--
Time flies like the wind. Fruit flies like a banana. Stranger things have .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net
|