Why does xargs cause apt-get to abort

aptxargs

I'm trying to remove a list of packages from a file. I'm using the following command:

cat packages | xargs sudo apt-get remove

packages is my file containing a list of packages I want to remove. Everything appears to work, but apt-get aborts instead of letting me choose yes or no.

I know I can get around this with the -y option, but I would like to know why this is happening and how can I keep the interactive choice.

Best Answer

xargs -a packages sudo apt-get remove

will direct xargs to read arguments from packages, and so it will leave stdin unmolested.

Related Question