Re: [Bashburn-info] Fix up misc/check_path.sh
Brought to you by:
bashburn
From: Steven W. O. <st...@sy...> - 2008-09-30 13:40:27
|
On Tuesday, Sep 30th 2008 at 03:07 -0000, quoth Nick Warne: => =>I noticed this wasn't working right - I was told I had to install =>missing apps even if I had them all. => =>Looking at this, it was sooooooo convoluted logic the way a missing app =>was looked at. Putting echoes in, I was getting 14 apps found and 25 =>nr_apps. => =>Also, I haven't a clue what this line did: => =>nr_apps=$(( ${#BBBURNING} + ${#BBRIPPERS} + ${#BBXCODERS} + =>${#BBMISC} )) => =>Anyway, it is now fixed - easy to read and will always work, no matter =>how many apps are added at a later date. => =>The function is already THERE to test if an app exists. All we need to =>do is count the MISSING ones. If after the function, =>bb_not_found_apps != 0, then we know (but don't care which, the =>function deals with that) apps are missing, and thus just print the =>warning. => =>Oh, also the reason I looked at this file was to add a 'clear' so the =>display is all nice when the paths are printed to stdout. => =>Nick If you have an array aa, then ${#aa[@]} is equal to the number of elements in the array. I screwed up and said ${#aa} instead which only returned the length of the first element of the array. Your fix is fine. One criticism is that Boolean variables should never be tested to see if they are equal to True. Good form: if (( var )) if (( ! var )) if (( var != 0 )) Bad form: if (( var == 1 )) if (( ( var == 1 ) == 1 )) if (( ( var != 1 ) == 0 )) etc ... :-) The rest of it looks good. -- steveo at syslang dot net TMMP1 http://frambors.syslang.net/ Do you have neighbors who are not frambors? Steven W. Orr |