Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hey All, wrote this script to confuse my girlfriend when she is using my computer. The only trouble is that if the terminal gets closed the script stops to execute. It currently executes in the background but how can I make it run in the background but not in a terminal?

(sleep 5; say "Hello Girlfriend")&
share|improve this question
So where do you ultimately want to show her the message? – John T Feb 10 '10 at 5:14
If it's not running in a terminal, how do you expect to see the output? – pavium Feb 10 '10 at 5:15
@John T and pavium: the say command on Mac OS X is a voice to text to voice command. Ie: the command will read the text and play it on the speakers. – sixtyfootersdude Feb 10 '10 at 5:21
I suppose she gets confused because it says "girl frinde" instead of "girl friend"? – Nathaniel Feb 10 '10 at 5:31
Actually, I did notice the word 'say', but not being a Mac person I didn't catch on. If anything I might have thought of the say function in Perl 5.10 – pavium Feb 10 '10 at 6:09
up vote 1 down vote accepted

You could schedule it to run at a specific time with at or cron in the background.

share|improve this answer

Have you tried nohup?

nohup command >/dev/null 2>&1 &
share|improve this answer

I promise that no matter how much she likes you, 5 seconds is too fast an interval. Really.

nohup (and in bash disown) will allow you to detach the process from the initiating terminal.

share|improve this answer

You can suspend execution by Ctrl-Z and then let it run in the background with bg ( background ).

If you want to bring it forth then fg or %.

share|improve this answer

use at or cron as john suggested, and then use wall to send her a message to her terminal.

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.