I don't understand the purpose of this script. I think you want something which does this, right?
- wait for 45 seconds
- if firefox is running, sleep another 15 seconds
- no matter if firefox was running or not, shutdown the computer
Weird script!
I think what you want to do is change the id statement like this:
Code:
if pidof firefox-bin; then
And if you don't want to see the PID printed on the terminal, you can re-direct stdout like this (and then we will just use the exit status of pidof:
Code:
if pidof firefox-bin > /dev/null; then
Note that sudo will probably prompt you for a password. I assume you've set up the sudoers file to make it possible to run shutdown without being prompted for the password.