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?