Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want firefox to restart automatically when I close it. I found this script

#! /bin/sh

while [ true ]; do
        firefox
done

and I put a file with that script in the /etc/init.d folder. Firefox starts, but when I close it, it doesn't open again.

share|improve this question

migrated from stackoverflow.com Jun 10 '13 at 14:51

This question came from our site for professional and enthusiast programmers.

    
/etc/init.d is not the proper place for that script. See ghacks.net/2009/04/04/get-to-know-linux-the-etcinitd-directory -- a script that automatically restarts firefox seems like it belongs in your personal bin. –  cmt Jun 10 '13 at 11:52

1 Answer 1

You shouldn't use the test operator ([) around true:

#!/bin/sh
while true; do
    firefox
done
share|improve this answer
    
it doesn't work anyway. If I close firefox it doesn't open again. I'm using Ubuntu 10.04 –  Amk Jun 10 '13 at 10:21
    
Do you have any other windows of Firefox open? What happens if you add echo Restarting as the next line after firefox? –  Koterpillar Jun 10 '13 at 10:26
    
No. When I turn on the pc nothing is open, just the Firefox window. And I added the echo restarting line, but nothing happens. –  Amk Jun 10 '13 at 10:34
    
Can't reproduce it here. What's your environment (OS, Firefox version)? –  Koterpillar Jun 10 '13 at 10:37
    
What happens when you run firefox from a command prompt and then close its window? Do you see a prompt again? –  Koterpillar Jun 10 '13 at 10:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.