gpt4 book ai didi

unix - su oracle 和 su - oracle 之间的区别?

转载 作者:行者123 更新时间:2023-11-30 23:45:26 25 4
gpt4 key购买 nike

简单的问题,有什么区别

su oraclesu - oracle

我不确定 - 在这两个命令中的意义是什么。

更新:

执行 su oracle 后,尝试了 which sqlplus 但无法识别,但通过执行 su - oracle,设置了 sqlplus 环境。

最佳答案

根据手册页

 -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.

简而言之,如果您使用su - oracle,您会切换到用户oracle,并且环境会被重置。没有-,环境不会重置。

例如,没有 - :

#(root) export HELLO=world
#(root) su postgres
$(postgres) echo $HELLO
world
$(postgres)

还有 - :

#(root) export HELLO=world
#(root) su - postgres
$(postgres) echo $HELLO

$(postgres)

关于unix - su oracle 和 su - oracle 之间的区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14842749/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com