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

Re: Why has "find ... -exec rm -i '{}' ';'" stopped working?



> I have a script called texclean as follows:
> 
> #!/bin/sh
> if [ -z "$1" ]; then
>     DEPTH=1;
> else
>     DEPTH=$1;
> fi;
> for PATTERN in '*~' '*.log' '*.aux' '*.bbl' '*.blg' '*.toc' \
>                '*.lof' '*.lot' '#*#';
> do
>     find . -maxdepth $DEPTH -name "$PATTERN" -exec rm -i '{}' ';';
> done
> 
> 
> Recently it stopped working because "rm -i" in "find..." no longer appears
> connected to the console for input.  Typing "find -name '*~' -exec rm -i
> '{}' ';'" directly prints a list of rm-questions, doesn't get an answer,
> and so does nothing.
> 
> Why did this behaviour change, and how can I fix my script?

An alternative is

find ... -print0 | xargs -0r rm -i




Reply to: