The question is: Write a command to print the number of directories in /home that contain two consecutive vowels (lowercase).
I tried:
ls /home/*[aeiou][aeiou]*
however this is obvious on why it doesn't work.
I tried:
ls /home | grep *[aeiou][aeiou]*
and I get nothing. I know once I figure out how to isolate the directories with the two consecutive vowels I need to pipe that into the wc command. Or if I use grep to do it I can just use -c. I have also tried find but that was no good.
grep
does regex-matching, not glob matching.
ls -d */ | grep '[aeiou]\{2\}'
When you tried nearly the same thing, you did not quote the regular expression. That's why it didn't work for you: Shell treated the regexp as a file glob, expanding it to the list of matching files (if any), rather than passing the regexp to grep. Quoting the regexp prevents the shell from treating it as a glob and expanding it.
Thanks @harpo for how to filter for directories.