Dalla su
pagina man di:
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
È difficile dire se c'è qualche differenza tra -
e --login
(o presumibilmente solo -l
). Vale a dire, la pagina man dice "invece della sua scorciatoia -", ma tutte queste opzioni sono raggruppate insieme, e non vedo una spiegazione della differenza, se esiste del tutto.
UPD Ho verificato la domanda, che dovrebbe risolvere il mio problema . La domanda è sostanzialmente sulla differenza tra su
e su -
. E sto chiedendo della differenza tra su -
e su --login
. Quindi no, non lo risolve affatto.
su
e su -
. E sto chiedendo della differenza tra su -
e su --login
. Cosa mi sto perdendo qui?
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.