Sco*_*ack 16
添加该-选项会影响您的环境行为。出于所有实际目的,环境已完全重置。通常,您可能希望使用su -而不是普通的su. 从手册页:
-l Simulate a full login. The environment is discarded except for HOME, SHELL, PATH, TERM, and USER. HOME and SHELL are modified as above.
USER is set to the target login. PATH is set to ``/bin:/usr/bin''. TERM is imported from your current environment. The invoked shell is
the target login's, and su will change directory to the target login's home directory.
- (no letter) The same as -l.
Run Code Online (Sandbox Code Playgroud)
su -调用登录 shell,其中包括确保 root.bashrc和其他 shell 启动脚本运行,就像您通过控制台或 SSH 直接以 root 身份登录一样。根的个人资料通常设置路径,以包含/sbin这也正是ifconfig通常过着。