On 17 Nov 2017 10:38 +0800, from ggm(a)algebras.org (George Michaelson):
although why find . -type d -maxdepth 1 isn't
being used is beyond me.
(In normal usage) unless you want your dot-directories as well,
there's always good ol' \ls -1d */, or even echo */ if you can live
with the entries being all on one line separated by just one space.
Works nicely in an interactive shell, but may be slightly too
unreliable for a script (in GNU bash, the exact behavior depends on
the globbing options such as dotglob; other shells might act
differently based on state too, I just am not too familiar with them).
Using \ls above because some people (including myself) already have
their ls aliased to a ls command that includes -F, which looks ugly
when used with -d */. If you aren't one of them, then maybe you don't
need the backslash.
Using echo has the bonus that it's very often built in to the shell,
so no external invocation is required.
I don't think I'd call find minimalistic anything. :-) Modern ls is
pretty bloated too (surprisingly enough, on my system, the binary for
find is only about twice the size of the binary for ls; 233,968 and
114,032 bytes, respectively, but that's not counting any libraries
they pull in dynamically), but ls is probably in the disk cache
already; echo's nice and lean, though...
--
Michael Kjörling •
https://michael.kjorling.se • michael(a)kjorling.se
“People who think they know everything really annoy
those of us who know we don’t.” (Bjarne Stroustrup)