からsu
のマニュアルページ:
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
。つまり、マニュアル ページには「そのショートカット - の代わりに」と書かれていますが、これらすべてのオプションはグループ化されており、違いがあるとしても、その説明が見当たりません。
上院私は質問を確認しました。私の問題を解決する質問は基本的にsu
との違いについてです。そして私はとsu -
の違いについて尋ねています。ですから、いいえ、それはまったく問題を解決しません。su -
su --login
答え1
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.
答え2
違いはありません。走るのと同じです。
echo bob | grep -v bob
echo bob | grep --invert-match bob
ただの速記です...