我在一个命令的末尾使用了&cshell中的命令,以便从terminal执行一个独立的进程:
kate filename.txt&
我应该怎么做bash?
一样的方法。 从bash(1) :
If a command is terminated by the control operator &, the shell exe- cutes the command in the background in a subshell. The shell does not wait for the command to finish, and the return status is 0.
使用&will后台工作,但它仍然绑在壳。
你可能会发现在csh和bash之间的差异与是关于redirectSTDERR。
在csh中:
kate filename.txt >& kateout.log
在bash中:
kate filename.txt > kateout.log 2>&1
如果你希望进程能够在父shell /terminalclosures的情况下生存,请尝试“nohup”即:
nohup kate filename.txt > kateout.log 2>&1
redirect是可选的; 如果有输出,则会在当前工作目录下进入nohup.out。