I have a directory ~/Documents/machine_learning_coursera/.
The command
find . -type d -name '^machine'
does not find anything
I also tried
find . -type d -regextype posix-extended -regex '^machine'
so as to match the the beginning of the string and nothing.
I tried also with -name:
find . -type d -regextype posix-extended -regex -name '^machine'
and got the error:
find: paths must precede expression: `^machine'
What am I doing wrong here?
findand not by the shell. – terdon Jan 26 '21 at 10:03bash– Chris Davies Jan 26 '21 at 10:04'(.*/)?machine.*'would also match on files inside those directories as it matches on./machine/some/diras well. The(, and)?are unnecessary as all file paths (except.itself) start with./. – Stéphane Chazelas Jan 26 '21 at 11:27.*appropriately. I've left the(.*/)because it will match even when someone else changes the starting directory to something other than.such thatmachinematches at the top level – Chris Davies Jan 26 '21 at 12:27{}aren't really part of glob patterns, but a different thing, regardless of the find man page confusing them...{a,b}expands toa,beven if those files don't exist, unlike what happens with a glob. – ilkkachu Jan 26 '21 at 12:37