tobold.org

correct • elegant • free

△ comp.unix.shell △

◅ sed and quotes

Bourne sh: Execute Command in "if" Condition and Negate Return Value? ▻

find without subdirs

In article <39197AE6.1D16159@phys.uni-paderborn.de>,
Michael Sternberg  <sternberg@phys.uni-paderborn.de> wrote:
>   find /usr -name \*.h
>
>How do you prevent traversing /usr/include/sys/ based on the fact
>that there are matching files in /usr/include ?

A strange requirement, but I think this does what you want.

    find /usr -type d -exec sh -c 'ls "$1"/*.h 2>/dev/null' 0 '{}' ';' -prune

Tim.
--
Tim Goodwin   | "If you don't know what closures are, you probably don't
Leicester, UK | want to know what closures are." -- Larry Wall

Original headers:

From: tjg@star.le.ac.uk (Tim Goodwin)
Newsgroups: comp.unix.shell
Subject: Re: find without subdirs
Date: 11 May 2000 11:15:57 +0100
Message-ID: <8fe19j$an1$1@ltpcg.star.le.ac.uk>
References: <u8zxju3ed.fsf@sdm.de>
  <391855D9.D0888D03@phys.uni-paderborn.de>
  <FuCAs9.9BK.0.queen@torfree.net> <39197AE6.1D16159@phys.uni-paderborn.de>

△ comp.unix.shell △

◅ sed and quotes

Bourne sh: Execute Command in "if" Condition and Negate Return Value? ▻