How could I make a bash script to execute apt-get?

Posted by poz2k4444 on Super User See other posts from Super User or by poz2k4444
Published on 2012-10-18T18:17:21Z Indexed on 2012/10/18 23:05 UTC
Read the original article Hit count: 189

Filed under:

I'm trying to automatize some configurations I have with bash script, I've never done this before so I tried with something easy like a Hello World! and everything works just fine, but then I tried something like this:

#!/bin/bash
sudo su
apt-get purge postfix

and it doesn't do anything, I check and postfix is still installed, and at any time it asks for any entry of mine, I just tried with apt-get but I'll do things like ssh-keygen or even write files I guess with cat or something, how could I do the script working and also seeing what's going on?

© Super User or respective owner

Related posts about bash-scripting