Dari su
halaman manual:
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
Sulit untuk mengetahui apakah ada perbedaan antara -
dan --login
(atau seharusnya hanya -l
). Yaitu, halaman manual mengatakan "bukan pintasannya -", tetapi semua opsi ini dikelompokkan bersama, dan saya tidak melihat penjelasan tentang perbedaannya, jika ada sama sekali.
UPD Saya memeriksa pertanyaan, yang seharusnya menyelesaikan masalah saya. Pertanyaannya pada dasarnya adalah tentang perbedaan antara su
dan su -
. Dan saya bertanya tentang perbedaan antara su -
dan su --login
. Jadi tidak, itu tidak menyelesaikannya sama sekali.
Jawaban yang Diterima:
Entri manual Debian tampaknya lebih mencerahkan:
-, -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.
Journalctl:Bagaimana Mencegah Teks Terpotong Di Terminal?
Hentikan/bunuh Proses Dari Baris Perintah Setelah Jangka Waktu Tertentu?