TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Running bash commands in the background properly

32 点作者 felixmc超过 10 年前

5 条评论

Too超过 10 年前
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.
评论 #8711653 未加载
xyzzy_plugh超过 10 年前
Understanding whether background jobs get killed (via SIGHUP) or orphaned is not obvious without reading about the huponexit shopt. I&#x27;ve found some recent distros to not enable huponexit by default for login shells, and so this isn&#x27;t always an issue.<p>More importantly, understanding how your jobs behave when your SSH session is killed can be a huge timesaver.
pjbrunet超过 10 年前
The random shell output from &quot;background&quot; 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&#x27;s out of the way. Also tmux has ^bd to &quot;detach&quot; I think.
0942v8653超过 10 年前
Wouldn&#x27;t it be better to simply do<p><pre><code> &quot;$@&quot; &quot;${FD[@]&quot; &amp; </code></pre> And also remember to<p><pre><code> alias ds=&#x27;ds &#x27; </code></pre> to enable alias expansion.
评论 #8712860 未加载
plicense超过 10 年前
Added to &#x2F;bin&#x2F;sh