lundi 8 décembre 2014

Cannot prompt user using rm bultin prompt option -i with xargs and find


I am using xargs and rm with find in order to remove files that follow a specific pattern defined by find as follows.



touch file
find . -name file | xargs rm


Everything works fine with the above code, but if I enter the -i option to rm, then executing:



touch file
find . -name file | xargs rm -i


prints:



rm: remove regular empty file ‘./file7’? user@host:$



without letting me enter y or n ? Thus the file is not removed.


What's the problem in here ?


I also am aware of -p parameter of xargs which works but it is more general. That is, it prompts user to execute the specific command, which is not user-friendly.



Aucun commentaire:

Enregistrer un commentaire