How to run a script at logon in Windows 10 Bash shell?

How to run a script at logon in Windows 10 Bash shell?

How can I run a Bash script (such as https://github.com/willemdh/firemotd) when I open the Bash shell for Windows 10?

I tried putting a script in /etc/profile.d but it doesn't seem to get executed. Also tried executing the script from .profile in the main user home folder, but this also doesn't seem to work.

答案1

For newer versions of bash use ~/.bash_profile

  1. open bash shell
  2. vim ~/.bash_profile
  3. source ~/.bash_profile or exit shell then open shell

相关内容