Desde su
la página de manual de:
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
Es difícil saber si hay alguna diferencia entre -
y --login
(o supuestamente solo -l
). A saber, la página del manual dice "en lugar de su acceso directo -", pero todas estas opciones están agrupadas y no veo una explicación de la diferencia, si es que existe.
UPD Revisé la pregunta, que se supone que resuelve mi problema . La pregunta es básicamente sobre la diferencia entre su
y su -
. Y estoy preguntando sobre la diferencia entre su -
y su --login
. Entonces no, no lo resuelve en absoluto.
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.
su
ysu -
. Y estoy preguntando sobre la diferencia entresu -
ysu --login
. ¿Que me estoy perdiendo aqui?Respuestas:
La entrada manual de Debian parece ser más esclarecedora:
fuente
-
. Hablando de eso, ¿por qué "antes de cualquier nombre de usuario"?I disagree, however, with the general point that, "before any username" can be rephrased as "before the username, if any." Perhaps Mr. Plotnik meant that the man page* should have rephrased the text using his suggestion, but the two phrases are not equivalent (as I explained at the beginning of this post).
Es decir, Mark Plotnick sabe cómosu
funciona, pero "antes de cualquier nombre de usuario"! = "Antes del nombre de usuario, si lo hay". Esa es la conclusión a la que llegó la discusión, tal como la veo.no hay diferencia, es como correr;
solo taquigrafía ...
fuente
-
,-l
,--login
. Mi pregunta es sobre por qué no se recomienda su uso-
, en lugar de '-l, and
--login`.su
al escribir un guión?