4 ms·
> WHAT idiot would program a command so that you have to say -print to print the output to the screen. What IDIOT would make a command like this and not have t
by philh 11y ago
> WHAT idiot would program a command so that you have to
say -print to print the output to the screen. What IDIOT would make a command like this and not have the output go to the screen by default.
You don't need to say -print. It's always printed by default for me, and the man pages (on both linux and OS X) confirm this.
> If the expression contains no actions other than -prune, -print is performed on all files for which the expression is true. [linux]
> If none of -exec, -ls, -print, -print0, or -ok is specified, the given expression shall be effectively replaced by ( given expression ) -print. [OS X]
Has this only been added in the last 20 years?
- KWxIUElW8Xt0tD9 11y agoI have written many cross-platform shell scripts over the years. The -print option may have been made standard by the GNU implementation and then spread -- I don't know -- but at least on some older versions of UNIX you do indeed need to specify -print or it won't.
- vram22 11y agoYes, I think that is true. Speaking from memory, but I've worked on Unix for long, and I think I remember that on some older Unix versions, you had to specify -print, otherwise it would walk the directory tree according the conditions you specified (such as filename wildcards, the -o option (for OR), etc.), but would produce no output for that walk.
- deleted 11y ago[deleted]
- kabdib 11y agoThe -print option was not the default when I first used find (in v6 Unix, back in PDP-11 days). I don't recall what 4.2bsd did, which was the next version of Unix that I used. I thought it was pretty brain-damaged, and that whoever decided that had decided poorly. The author of the tool should have pushed back, IMHO. Then again, I don't know the political structure of the shop where find(1) was written, so maybe that was impossible.
- LukeShu 11y agoI've spent the morning trying to find the answer, and I don't have one. But I figured I'd share what I did gather. [N] 1982 4.1BSD [?] 1992 POSIX.2 (IEEE Std 1003.2-1992) [Y] 1993 FreeBSD 1.0 (though it wasn't mentioned in the man page) [Y] 1994 GNU find 4.0 [?] 2001 POSIX.1-2001 (IEEE Std 1003.1-2001) [Y] 2004 POSIX.1-2004 (IEEE Std 1003.1-2004) Edit: Nevermind, I have an answer: In on 1990-04-17, Keith Bostic made a commit with the message "new version derived from Cimarron Taylor's", which introduced it to BSD between 4.3-Tahoe and 4.3-Reno. Shortly after, on 1990-06-03, David MacKenzie added an entry to the ChangeLog that added it to GNU find 1.2.