以下からsu
のmanページ:
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
-
and --login
(またはおそらく-l
)の間に違いがあるかどうかを判断するのは困難です。つまり、マニュアルページには「ショートカットの代わりに-」と書かれていますが、これらのオプションはすべてグループ化されており、違いが存在する場合、その説明は表示されません。
UPD私は質問をチェックしました。これは私の問題を解決することになっています。質問は間違いについて基本的にあるsu
とsu -
。そして、私はsu -
との違いについて尋ねていsu --login
ます。だから、それはまったく解決しません。
私はあなたの重複の定義を知りませんが、私の質問をそのように考えません。あなたが提案する質問は間違いについて基本的にある
—
x-yuri
su
とsu -
。そして、私はsu -
との違いについて尋ねていsu --login
ます。ここで何が欠けていますか?
To avoid side effects caused by mixing environments use --login option or its equivalent -. The first form is recommended because - can be placed only just before username.