On Mon, Jul 18, 2005 at 11:37:19AM +1000, Russell Shaw wrote:
I haven't used the -ok feature, so this is only my guess of what
should happen.
If find is fed with a pipe for stdin, questions asked by -ok should
open a new file descriptor for the controlling tty. If the process
group is in a session that has no controlling tty, then find should
block or exit on a TTIN/TTOU signal.
This is an interesting idea and straightforward to implement. Is
there a consensus in favour of this?
It would save scripts being accidently run by batch jobs that would
normally ask questions about doing large deletions. If the user
intended that, they should edit out the -ok command.
Indeed.
The other way is to have an extra option that tells find to assume
yes or no for -ok when run without access to a controlling
tty. Maybe -nok for assume "no" and -yok to assume "yes".
Well, -yok would just be -exec and -nok would just be -false (with the
arguments removed).