This was added to OpenBSD 17 years ago. Other BSDs soon followed. Solaris & IllumOS support it too.
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/find/op...
Apologies for this. It just goes to show how fallible the human memory is. :-/
ls **/*.c
Results in something like: array.c helpers/gendec.c msg.c
awkgram.c helpers/mb_cur_max.c node.c
awklib/eg/lib/grcat.c helpers/scanfmt.c old-extension/bindarr.c
Turn on with: shopt -s globstarWant to mess with such a script?
$ touch "$(echo -e -n 'lol\nposix')"
If you're trying it out now and cannot figure out how to delete it: "ls -li" to find the file's inode number, then `find -inum $INODE_NUMBER -delete`.
If anyone wants a command to make one, try
touch $'\U035F'
(using U+035F COMBINING DOUBLE MACRON BELOW for no particular reason, see [1] for more)[1]: https://en.wikipedia.org/wiki/Combining_Diacritical_Marks
However for normal day to day usage, file names with \n are rare while files with spaces in their name are common. So returning an array of space delimited file names is a potentially dangerous practice for common scenarios where as find's default behaviour is only dangerous for weird and uncommon edge cases. (And if you think those are a likely issue then you probably shouldn't be doing your file handling inside a POSIX shell in the first place).
Lastly, in both the above examples you're returning files and directories rather than just files. If you wanted to exclude directories then use the `-type f` flag to specify files:
(equally you could specify only directories with `-type d`)Other `find` tips I've found useful that might be worth adding:
* You don't need to specify the source directory in GNU find (you do on FreeBSD et al) so if you're lazy then `find` will default to your working directory:
* You can do case insensitive named matches with `-iname` (this is also GNU specific):