1

The problem is that if I execute a command (eg. a Python script), the terminal or script is waiting until the program return a exit status so that it can continue or return to terminal. Is there a way to circumvent this?

3 Answers3

3

In most shells, you can launch commands or processes in the background by appending an ampersand (&) to the command:

python file.py &
poke
  • 649
  • 4
  • 10
  • 25
1

Several choices:

  1. Run it in screen. man screen, screen, myprorgamm, C-a d, screen -r.
  2. nohup myprogramm
  3. myprogramm &
  • Tried: `$ screen _command_`, `$ nohup _command_` `$ _command_ &`. Nothing worked so far. –  Jan 14 '13 at 20:19
  • You need to start screen separately first; and if you don’t have screen, install it first. – poke Jan 14 '13 at 20:20
  • 1
    for screen - start with `man screen`, it's complex app with lots and lots of functionality. `nohup` and `&` (aka detach) can't "not work", really. if there is any error - make sure to post it here. –  Jan 14 '13 at 20:23
  • Hey, the amperstand workaround is working, but for some unknown reason I must double-click on a terminal window because the new line does not show up for some reason. Solved, thank you! –  Jan 14 '13 at 20:32
0

Yes. If you're using Bash or a similar shell, type:

./your_script.py &
  • Tried that from the terminal but it does not work. –  Jan 14 '13 at 20:04
  • What OS and shell are you using? –  Jan 14 '13 at 20:05
  • _Trisquel GNU/Linux_ with _dash_. In Terminal I am using _bash_, while in scripts _dash_. Either of these does not work. The command I am trying to execute is _/usr/share/screenlets/CircleClock/CircleClockScreenlet.py_ which is a part of a program called _Screenlets_ (also available in _Ubuntu_). –  Jan 14 '13 at 20:13