http://www.nytimes.com/2008/09/14/opinion/14rich.html?ref=opinion
The New York Times September 14, 2008 Op-Ed Columnist The Palin-Whatshisname Ticket By FRANK RICH WITH all due deference to lipstick, let’s advance the story. A week ago the question was: Is Sarah Palin qualified to be a heartbeat away from the presidency? The question today: What kind of president would Sarah Palin be? It’s an urgent matter, because if we’ve learned anything from the G.O.P. convention and its aftermath, it’s that the 2008 edition of John McCain is too weak to serve as America’s chief executive. This unmentionable truth, more than race, is now the real elephant in the room of this election. No longer able to remember his principles any better than he can distinguish between Sunnis and Shia, McCain stands revealed as a guy who can be easily rolled by anyone who sells him a plan for “victory,” whether in Iraq or in Michigan. A McCain victory on Election Day will usher in a Palin presidency, with McCain serving as a transitional front man, an even weaker Bush to her Cheney. The ambitious Palin and the ruthless forces she represents know it, too. You can almost see them smacking their lips in anticipation, whether they’re wearing lipstick or not. This was made clear in the most chilling passage of Palin’s didn't under bash. > > My original code looked something like: > > ls -lR /media/cdrom > $TMP1 > while [ -s $TMP1 ] ; do > LINE=`head -1 $TMP1` > [process LINE, result in OUTLN] > echo $OUTLN >> $TMP3 > tail +2 $TMP1 > $TMP2 > mv -f $TMP2 $TMP1 > done > cat $TMP3 >> $OUTPUTFILE > > which worked, but slowly. > > CONTENTS=`ls -lR /media/cdrom` > echo $CONTENTS | while read LINE ; do > [process LINE, results in OUTLN] > RESULTS="$RESULTS > $OUTLN" > done > > barfed when CONTENTS was too long. In my test case, it was over a > megabyte. And trying to append the results to a variable didn't work > either. And, as already discussed, the values of the variables > disappeared once the loop was done. Yeah, you want to avoid the big shell variables :-). Writing to a temporary file will certainly work, be aware that there can be security implications to temporary files (see http://www.codeproject.com/KB/web-security/TemporaryFileSecurity.aspx and other locations) Also, instead of writing to a temporary file and then copying to an output file, have you considered something like this? ls -lR /media/cdrom | while read LINE; do [process LINE, results in OUTLN] echo $OUTLN >>$OUTPUTFILE done > > Next I tried: > > ls -lR /media/cdrom > $TMP1 > while read LINE < $TMP1 ; do > [process LINE, results in OUTLN] > echo $OUTLN >> $TMP2 > done > cat $TMP2 >> $OUTPUTFILE > > and 'while' kept rereading the first line of TMP1. The latest revision, > which I don't think deserves a UUOC award, is: > > ls -lR /media/cdrom > $TMP1 > cat $TMP1 | while read LINE ; do > [process LINE, results in OUTLN] > echo $OUTLN >> $TMP2 > done > cat $TMP2 >> $OUTPUTFILE > > which works, and is a lot faster than the first version. > > This loop intentionally gets and processes one line at a time. Actually > I used "while read F1 F2 F3 F4 F5" which also separated the line into > fields by whitespace, thus accomplishing two things with one command. > > Anyway that's where things stand. I hope this is helpful to somebody at > some point. > > Adam > > _______________________________________________ > Mid-Hudson Valley Linux Users Group http://mhvlug.org > > http://mhvlug.org/cgi-bin/mailman/listinfo/mhvlug > Upcoming Meetings (6pm - 8pm) MHVLS Auditorium > > Sep 3 - Porkchop - The Areas of My Expertise > Oct 1 - Ubikeys > Oct 4 - Linux Fest > Nov 5 - Releasing Open Source Software > Dec 3 - TBD > > ============================================================================= michaelMuller = [EMAIL PROTECTED] | http://www.mindhog.net/~mmuller ----------------------------------------------------------------------------- Lokah Samasta Sukhino Bhavantu - May all beings everywhere be happy and free. And may my own thoughts and actions contribute to that happiness and freedom. ============================================================================= _______________________________________________ Mid-Hudson Valley Linux Users Group http://mhvlug.org http://mhvlug.org/cgi-bin/mailman/listinfo/mhvlug Upcoming Meetings (6pm - 8pm) MHVLS Auditorium Sep 3 - Porkchop - The Areas of My Expertise Oct 1 - Ubikeys Oct 4 - Linux Fest Nov 5 - Releasing Open Source Software Dec 3 - TBD
