On 2020-04-12 21:12, Peng Yu wrote:
> OK. So this will make sure `/d1/d2/d3` will not be searched multiple
> times? Or it is still searched when `/d1/d2`, `/d1` or `/` is
> searched?
Well, it's easy to go up the tree and using the -prune option
to omit the already searched directories.
---8<---8<
OK. So this will make sure `/d1/d2/d3` will not be searched multiple
times? Or it is still searched when `/d1/d2`, `/d1` or `/` is
searched?
On 4/12/20, Bernhard Voelker wrote:
> On 2020-04-11 12:19, Peng Yu wrote:
>> Recursive also means subdirectories, sub subdirectories, etc.
>
> ah, so you wa
On 2020-04-11 12:19, Peng Yu wrote:
> Recursive also means subdirectories, sub subdirectories, etc.
ah, so you want to fall back for the search to the parent and all
parent directories. E.g. if you are in
/d1/d2/d3
then you want to search in
/d1/d2/d3
falling back to
/d1/d2
and
/d1
and
Recursive also means subdirectories, sub subdirectories, etc.
On Sat, Apr 11, 2020 at 4:17 AM Bernhard Voelker
wrote:
> On 2020-04-10 19:29, Peng Yu wrote:
> > On 4/10/20, Bernhard Voelker wrote:
> >> ---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---
> >> #!/bin/sh
> >>
> >> f="$1" \
>
On 2020-04-10 19:29, Peng Yu wrote:
> On 4/10/20, Bernhard Voelker wrote:
>> ---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---
>> #!/bin/sh
>>
>> f="$1" \
>> && test -n "$f" \
>> || { echo "Usage: $0 FILE" >&2; exit 1; }
>>
>> p="."
>>
>> # Search until the parent is identical to the
Thanks. I will need to search the parent directory recursively. Does
this code only search whether a file is in a parent their parents,
etc., but not recursively for a given ancestor?
On 4/10/20, Bernhard Voelker wrote:
> On 2020-04-10 16:09, Peng Yu wrote:
>> Hi,
>>
>> I'd like to look for a fil
On 2020-04-10 16:09, Peng Yu wrote:
> Hi,
>
> I'd like to look for a file by its name in the current directory. If
> not found, go the the parent and look for it again. If not go up one
> level again and look for it, ... until it is found (or until a given
> level is reached). If the file is not f