On Fri, Dec 11, 2009 at 12:31:49PM +0000, pk wrote:
> Marc Herbert wrote:
> > is_file3()
> > {
> > for f
> > do
> > [ -e "$f" -o -L "$f" ] && return
> > done
> > return 1
> > }
>
> You might also want to enable "dotglob" to catch hidden files...
empty=yes
for i in .?* *
do
test "$i" = '..' || test -e "$i" && empty=no && break
done
and with test -L added as needed.
Or (beacuse test -e is not strictly traditionally available)
and without special glob options:
empty=no
for i in .* * ; do
case "$i" in
.|..) : ;;
\*) for i in ? ; do
test "$i" = \? && empty=yes ; break
done ; break ;;
*) break ;;
esac
done
or just (if builtins-only is not strictly required)
test -z "`find . ! -name . -prune | sed q`"
comp.unix.shell might match well here and could be entertaining -
IMHO worth to migrate; objections?