I tried finding some files (
*.e*) that are in the same directory as another file (
md.tpr). I needed to list them (for further processing) using the following:
find . -name md.tpr -execdir ls *.e* \;
I tried a few variants of this command and some others (including single quoting the command passed to
-execdir or passing it as
sh -c 'ls *.e*' or
eval 'ls *.e*' to name a few). It appears that globbing is not working when passed to
-execdir. The error I get when running the above command is:
ls: *.e*: No such file or directory
Just as a sanity check, I did
-execdir pwd and it prints what it should, so it appears that it's a problem with globbing, as those
*.e* files do exist in the directories listed with this test.
Now, I was able to solve this problem in a much less elegant way but it just baffled me why globbing and wildcards wouldn't work here. Any ideas? Or am I completely off the track?
I use bash 3.2.25 (old but I don't have admin rights on that system).
Also, interestingly, if I do
find ~ -name .bashrc -maxdepth 2 -execdir ls -d .b* \;
it doesn't work unless it's done from