[sbopkg-users] Obsolete Packages

slakmagik jsunx1 at bellsouth.net
Wed Mar 4 23:35:56 UTC 2009


On 2009-03-04 (Wed) 16:55:04 [-0600], alkos333 wrote:
> On Wed, Mar 4, 2009 at 4:36 PM, slakmagik <jsunx1 at bellsouth.net> wrote:
> >
> > The above would need to be something like
> >
> > for pkg in /home/slackbuilds/pkgs/*.tgz; do
> >      pkgfile=${pkg##*/}
> >      if [ ! -f /var/log/packages/${pkgfile%.tgz} ]; then
> >            rm $pkg
> >      fi
> > done
> >
> > to do the path substitution as well as extension removal.
> >
> 
> I don't see the point of hardcoding the search path and the defining pkgfile
> 

Crap. I just changed the search path to run it off the command line and
it should have been changed back before I mailed it, but I forgot.

But the definition of pkgfile is because your

    if [ ! -f /var/log/packages/${pkg%.tgz} ]; then

expands to

    if [ ! -f /var/log/packages//value/of/OUTPUT/pkgname ]; then

The expansion of $OUTPUT (or '/value/of/output') needs to be removed and
doing two parameter expansions is faster than 'basename $pkg .tgz'. You
could also 'cd $OUTPUT' and then do 'for pkg in *.tgz', I guess, though
I'd rather not.


More information about the sbopkg-users mailing list