bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: -ok not totally OK


From: Eric Blake
Subject: Re: -ok not totally OK
Date: Mon, 13 Oct 2008 20:06:40 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.17) Gecko/20080914 Thunderbird/2.0.0.17 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to address@hidden on 10/13/2008 1:14 PM:
> Regarding "-ok": if you want to type y but by mistake you type
> anything else, you have to start all over again. Therefore there
> should also be a "p" offered: "bring me back to the previous line
> and ask me again".

Sorry, but POSIX doesn't permit this.
http://www.opengroup.org/onlinepubs/009695399/utilities/find.html

> 
> Please add to this the reason why standard input is redirected from
> /dev/null vs. -exec. (Otherwise seems just for spite.)

Hmmm.  POSIX doesn't mention that -ok should redirect stdin; on the other
hand, it doesn't seem to explicitly forbid it.  The redirection is done so
that reading your response doesn't interfere with the child processes
trying to read from stdin (if either one reads more bytes than strictly
necessary, then you've lost input data and put the next reader out of sync).

> 
> Also mention if one then indeed needs stdin, a workaround is
> -ok true \; -exec, e.g.,
> -ok true \; -exec ed {} \;
> -ok true \; -exec mplayer {} \;
> 
> Also it seems an -ok + and -okdir + could be implemented just as there
> now is -exec + and -execdir +.

POSIX explicitly allows the omission of -ok +.  Besides, what semantics
would you give it?  Is it an all-or-none action on the directory?  If you
still end up asking once per file, then what good did it do?

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjz/rAACgkQ84KuGfSFAYDAJQCfQmKRB9oAncuWhsPkQXAsYPRs
YR0AoNJE9WhrUtgQxtygl9SZDVM18lIi
=D2Hb
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]