【发布时间】:2022-01-21 08:34:59
【问题描述】:
我想在启动时以 root 身份启动程序,并将以下行之一添加到 rc.local:
sudo /path/my_prog
sudo sh -c "/path/my_prog"
su -c "/path/my_prog"
这三行有什么区别,哪一行是正确的?
【问题讨论】:
-
grep '^' file和cat file有什么区别? :-) -
也许另见 Running a command with
bash -cvs without(显然问题是关于 Bash,而不是sh;但部分问题显然也适用于sh -c command和command)。跨度>