来自su's主页:
For backward compatibility, su defaults to not change the current directory
and to only set the environment variables HOME and SHELL (plus USER and LOGNAME
if the target user is not root). It is recommended to always use the
--login option (instead of its shortcut -) to avoid side effects caused
by mixing environments.
...
-, -l, --login
Start the shell as a login shell with an environment similar to a real login:
o clears all the environment variables except TERM
o initializes the environment variables HOME, SHELL, USER, LOGNAME, and PATH
o changes to the target user's home directory
o sets argv[0] of the shell to '-' in order to make the shell a login shell很难判断-和--login之间是否有什么区别(或者应该只有-l)。也就是说,手册页上写着“而不是它的快捷方式-",但是所有这些选项都是分组在一起的,如果存在的话,我看不出有什么区别的解释。
UPD我检查了问题,这应该是解决我的问题。问题基本上是关于su和su -之间的区别。我在问su -和su --login之间的区别。所以不,它根本解决不了这个问题。
发布于 2016-10-24 16:42:36
Debian的手册条目似乎更有启发性:
-, -l, --login
Provide an environment similar to what the user would expect had the user logged
in directly.
When - is used, it must be specified before any username. For portability it is
recommended to use it as last option, before any username. The other forms (-l
and --login) do not have this restriction.发布于 2016-10-24 16:37:30
没有什么不同,就像跑步一样;
echo bob | grep -v bob
echo bob | grep --invert-match bob只是速记..。
https://unix.stackexchange.com/questions/318572
复制相似问题