On 19/07/2022 11:37, Magnus Sandberg wrote:
Hi,

After a few minutes of manual testing at my shell prompt, I guess this one does the same;

find ${PREFIX} -type f -name '*.gpg' | grep -i "${terms}" \
    | sed -E "s|^${PREFIX}/||" | sed -E 's/\.gpg$//' | sort



Assuming that 'grep -i "${terms}"' would give the same result as
'tree ... -P "${terms%|*}" ...'

I would prefer a version which is not reliant on tree, too. especially since it seems very fragile to try to remove the glyphs used for the tree in the output. (in fact, on my EL7 box, the version of tree shipped with the distro is incompatible with pass, so I run find(1) manually instead!)

A small point - I think it is better to remove the prefix and .gpg suffix before the grep to avoid unwanted matches (e.g., searching for "home" :)

--
Kjetil T. Homme
Redpill Linpro AS - Changing the game

Reply via email to