Release Jed 0.99.18-1

G. Milde g.milde at web.de
Mon May 15 12:37:12 UTC 2006


On 15.05.06, Rafael Laboissiere wrote:
> * G. Milde <g.milde at web.de> [2006-05-15 10:19]:
> 
> > What we need is a double test: if /etc/jed-init.d/ exists *and* is empty,
> > remove it.
 
> What about this:

> if [ -d /etc/jed-init.d/ -a -z "$(ls /etc/jed-init.d/ 2>/dev/null)" ]; then
>     rmdir /etc/jed-init.d"
> fi


This is still quite convoluted. Actually, rmdir does never remove a
directory that is not empty (according to the man page:   
    rmdir - löscht leere Verzeichnisse
).

So we could skip the test and do instead:

if [ -d /etc/jed-init.d/ ]; then
    rmdir --ignore-fail-on-non-empty /etc/jed-init.d"
fi

(Provided the --ignore-fail-on-non-empty option is availbale on all used
shell variants.)

Or put the rmdir in a try clause:

if [ ! `rmdir /etc/jed-init.d` ]; then 
  echo "" # pass
fi

Or combine the two approaches to get a helpfull output:

if [ -d /etc/jed-init.d/ ]; then
  if [ ! `rmdir /etc/jed-init.d` ]; then 
    echo "/etc/jed-init.d/ has been renamed to /etc/jed.d/.
    Please move or delete remaining files from /etc/jed-init.d/ 
    and then delete /etc/jed-init.d/ itself."
  fi
fi  



Guenter

-- 
Milde ife.et.tu-dresden.de



More information about the Pkg-jed-devel mailing list