分页: 1 / 1

帮忙解释一下这段代码的意思吧?

发表于 : 2010-02-23 18:27
新office菜鸟
请问:
ps -e | grep fcitx (ps -A | grep fcitx)
kill -9 fcitx的pid (pkill -9 fcitx)
fcitx nohup fcitx &

这段代码大体的意思应该是先杀掉fcitx进程,然后再启它,
但我不明白,为什么要用fcitx nohup fcitx &而不直接用fcitx呢?
fcitx后面的nohup是什么意思呀?后面为什么又要多加一个fcitx &呢?
请各位指导一下吧,谢谢了。

Re: 帮忙解释一下这段代码的意思吧?

发表于 : 2010-02-24 2:30
xiaomao101
nohup is a POSIX command to ignore the HUP (hangup) signal, enabling the command to keep running after the user who issues the command has logged out. The HUP (hangup) signal is by convention the way a terminal warns depending processes of logout.
来自 wikipedia{nohup}
个人觉得“fcitx nohup fcitx &”如果直接输入到终端是不合理的。
这样会造成终端(以后台方式)运行fcitx,然后传递两个参数(其实就是两个字串)“nohup”和“fcitx”给fcitx这个进程。
你可以尝试使用“gedit nohup gedit &”来泡泡看。

“&”是后台运行。
你可以试试
shell> gedit

shell> gedit &
有啥不同,是终端界面上有啥不同,不是gedit这个程序界面上。
更多知识可以google“linux 命令 后台运行”

Re: 帮忙解释一下这段代码的意思吧?

发表于 : 2010-02-24 13:47
新office菜鸟
xiaomao101 写了:nohup is a POSIX command to ignore the HUP (hangup) signal, enabling the command to keep running after the user who issues the command has logged out. The HUP (hangup) signal is by convention the way a terminal warns depending processes of logout.
来自 wikipedia{nohup}
个人觉得“fcitx nohup fcitx &”如果直接输入到终端是不合理的。
这样会造成终端(以后台方式)运行fcitx,然后传递两个参数(其实就是两个字串)“nohup”和“fcitx”给fcitx这个进程。
你可以尝试使用“gedit nohup gedit &”来泡泡看。

“&”是后台运行。
你可以试试
shell> gedit

shell> gedit &
有啥不同,是终端界面上有啥不同,不是gedit这个程序界面上。
更多知识可以google“linux 命令 后台运行”
非常感谢大家,
不过有一个地方不明白的,nohup gedit 这两个参数是用来干什么的或?起到什么作用呀?

Re: 帮忙解释一下这段代码的意思吧?

发表于 : 2010-02-24 13:52
adagio
gedit 是一个文本编辑程序,不是参数

nohup类似于把程序变成服务方式运行,这样即使你注销了桌面,fcitx仍然在运行

Re: 帮忙解释一下这段代码的意思吧?

发表于 : 2010-02-24 13:58
新office菜鸟
adagio 写了:gedit 是一个文本编辑程序,不是参数

nohup类似于把程序变成服务方式运行,这样即使你注销了桌面,fcitx仍然在运行
非常感谢大家,
“fcitx nohup fcitx &”这里的第二个参数fcitx是何意思呀?或者整段话是什么意思呀?谢谢了。

Re: 帮忙解释一下这段代码的意思吧?

发表于 : 2010-02-24 13:58
tenzu
加个&足够了吧,还用nohup

Re: 帮忙解释一下这段代码的意思吧?

发表于 : 2010-02-24 16:50
xiaomao101
新office菜鸟 写了:
adagio 写了:gedit 是一个文本编辑程序,不是参数

nohup类似于把程序变成服务方式运行,这样即使你注销了桌面,fcitx仍然在运行
非常感谢大家,
“fcitx nohup fcitx &”这里的第二个参数fcitx是何意思呀?或者整段话是什么意思呀?谢谢了。
不好意思没说清楚,叫“参数”容易混淆,还是叫“字符串”吧。
首先,这个“fcitx nohup fcitx &”是你从那里看道的呢?这种写法我觉得有问题(待商榷)。
因为你会发现在终端运行:
shell> fcitx nohup fcitx &
和运行:
shell> fcitx &
这两个效果是一样的。

“fcitx nohup fcitx &”后面的“nohup fcitx”对于你运行fcitx是没有起到作用的。
只有最后的“&”起到了后台运行的作用了。

可以参考bash shell编程学习这些东西。

Re: 帮忙解释一下这段代码的意思吧?

发表于 : 2010-02-24 16:53
delectate
记得我在原帖回复lz了 :em06

viewtopic.php?f=48&t=257933

11#

Re: 帮忙解释一下这段代码的意思吧?

发表于 : 2010-02-24 16:58
xiaomao101
哦,这个“fcitx nohup fcitx &”真的把我搅糊涂了。

Re: 帮忙解释一下这段代码的意思吧?

发表于 : 2010-02-24 17:02
delectate
xiaomao101 写了:哦,这个“fcitx nohup fcitx &”真的把我搅糊涂了。
my fault

sorry there

it's

代码: 全选

nohup fcitx &

Re: 帮忙解释一下这段代码的意思吧?

发表于 : 2010-02-24 17:26
qkbeyond
不知道 :em06

fcitx也不用非得这么着吧

Re: 帮忙解释一下这段代码的意思吧?

发表于 : 2010-02-24 18:08
xiaomao101
delectate 写了:
xiaomao101 写了:哦,这个“fcitx nohup fcitx &”真的把我搅糊涂了。
my fault

sorry there

it's

代码: 全选

nohup fcitx &
呵呵,不过学到一个新的东西nohup

Re: 帮忙解释一下这段代码的意思吧?

发表于 : 2010-02-24 20:50
新office菜鸟
delectate 写了:
xiaomao101 写了:哦,这个“fcitx nohup fcitx &”真的把我搅糊涂了。
my fault

sorry there

it's

代码: 全选

nohup fcitx &
谢谢,
fcitx nohup fcitx &”
是否应该写成nohup fcitx &呀?