3

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")&
5
  • So where do you ultimately want to show her the message?
    – user1931
    Commented Feb 10, 2010 at 5:14
  • 1
    If it's not running in a terminal, how do you expect to see the output?
    – pavium
    Commented Feb 10, 2010 at 5:15
  • 4
    @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. Commented Feb 10, 2010 at 5:21
  • I suppose she gets confused because it says "girl frinde" instead of "girl friend"?
    – Nathaniel
    Commented Feb 10, 2010 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
    Commented Feb 10, 2010 at 6:09

5 Answers 5

1

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

4

Have you tried nohup?

nohup command >/dev/null 2>&1 &
2

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.

0

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 %.

0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .