Can anyone do me a quick script

Associate
Joined
10 Jul 2006
Posts
2,423
I have a text file with packages I want removed (One per line)

sudo apt-get remove --purge *package here*

and then an autoremove at the end (I think those are the commands).

Can anyone quickly create me a script todo it?
 
Can't test it because I'm not running ubuntu but try
Code:
#!/bin/bash
cat /path/to/file.txt | while read package ;
do
 sudo apt-get remove --purge $package
done
sudo apt-get autoremove
 
Back
Top Bottom