On Fri, Feb 21, 2003, Bill Campbell wrote: > I've encountered a problem with the openpkg/shtool script when running the > mysql daily program, openpkg-20030203-20030203. Around line 1816, > ``optionally take logfile size into account'', it's using what seems to me > to be a fairly comples combination of ``set, ls, and sed'' to compute the > file size which actually is returning the user or group name on a SuSE 8.1 > Linux system. > > It seems to me that this would be much simpler using something like this: > size=`ls -l $ldir/$file | awk '{printf "%d\n", $5}'` > > I'm attaching a diff for shtool that does this.
Be careful. The reason for the current "complex" combination of set, ls and sed is to take the "last - 4"th argument while are taking just the 5th argument from the front. Unfortunately the "ls -l" output contains +1/-1 number of columns in front of the size column. For instance, as far as I can remember most Unix platforms output user and group fields, some other strange ones just the user column. So your change might break other platforms. Can you provide me the output of.. $ ls -l <prefix>/var/mysql/mysqld.err $ ls -l <prefix>/var/mysql/common.log $ ls -l <prefix>/var/mysql/update.log ...on your SuSE platform? There seem to be some additional columns at the end, I think. > The patch also includes ``id'' calls to fix problems that occur when > running on a Linux system using nss_ldap and nss_ldap where the openpkg > users aren't in the /etc/{passwd,group} files or found with ypcat. This part of your patch is fine and reasonable. I'll include this for the forthcoming GNU shtool 2.0.0. Ralf S. Engelschall [EMAIL PROTECTED] www.engelschall.com ______________________________________________________________________ The OpenPKG Project www.openpkg.org Developer Communication List [EMAIL PROTECTED]