News for hackers. Stuff that matters.
Re:Running bash commands in the background properly by Too on Sunday December 07, 2014 @02:53AM (#8711606)
I found 'screen' to be pretty handy for running scripts in the background. Then you can also reattach later to look at stdout as it's running.
Re:Running bash commands in the background properly by chinpokomon on Sunday December 07, 2014 @03:16AM (#8711653)
Screen or tmux. I tend to prefer tmux, but the both have this ability. I'm actuality surprised that there isn't a more elegant choice other than redirecting stdout and stderr to /dev/null where you can fork jobs to a background and reattach later to see the tty. Is there a shell that has a job queue that can be accessed from any number of shells?
Re:Running bash commands in the background properly by ordinary on Sunday December 07, 2014 @03:52AM (#8711698)
There's this for attaching a running program to your terminal when it is not started in screen: https://github.com/nelhage/reptyr
Re:Running bash commands in the background properly by xyzzy_plugh on Sunday December 07, 2014 @04:12AM (#8711719)
Understanding whether background jobs get killed (via SIGHUP) or orphaned is not obvious without reading about the huponexit shopt. I've found some recent distros to not enable huponexit by default for login shells, and so this isn't always an issue.

More importantly, understanding how your jobs behave when your SSH session is killed can be a huge timesaver.

Re:Running bash commands in the background properly by pjbrunet on Sunday December 07, 2014 @02:11AM (#8711543)
The random shell output from "background" apps never bothered me that much ;-) Crunchbang you can just press F2 and get auto-complete and launch commands with no shell output. Ubuntu has something similar. If you have terminator, just split the pane if you need a fresh one, or drag the terminal to another workspace and it's out of the way. Also tmux has ^bd to "detach" I think.
Re:Running bash commands in the background properly by 0942v8653 on Sunday December 07, 2014 @06:31AM (#8711903)
Wouldn't it be better to simply do

    "$@" "${FD[@]" &
And also remember to

    alias ds='ds '
to enable alias expansion.
Re:Running bash commands in the background properly by felixmc on Sunday December 07, 2014 @12:28PM (#8712860)
would you mind explaining why that might be better?
Re:Running bash commands in the background properly by 0942v8653 on Monday December 08, 2014 @03:47PM (#8719075)
It avoids a call to eval, which is always good. It's also a bit simpler.
Re:Running bash commands in the background properly by plicense on Sunday December 07, 2014 @02:03AM (#8711527)
Added to /bin/sh