我知道我曾经知道如何执行此操作,但是...如何在 unix 登录时运行脚本(bash 可以)?
最佳答案
When Bash starts, it executes the commands in a variety of different scripts.
When Bash is invoked as an interactive login shell, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.
When a login shell exits, Bash reads and executes commands from the file ~/.bash_logout, if it exists.
When an interactive shell that is not a login shell is started, Bash reads and executes commands from ~/.bashrc, if that file exists. This may be inhibited by using the --norc option. The --rcfile file option will force Bash to read and execute commands from file instead of ~/.bashrc.
关于linux - 如何在 *nix 中登录时运行脚本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/97137/