msys2 / msys2-runtime

Our friendly fork of Cygwin 💖 https://cygwin.org 💖 see the wiki for details
https://github.com/msys2/msys2-runtime/wiki
GNU General Public License v2.0
173 stars 38 forks source link

changes in ~/.profile are useless #169

Closed asd-a closed 5 months ago

asd-a commented 10 months ago

i add echo 1 to ~/.profile, but there is no difference

sskras commented 10 months ago

Since .bash_profile is present, the .profile is used only by Bourne-like, POSIX shells, eg. Dash: https://shreevatsa.wordpress.com/2008/03/30/zshbash-startup-files-loading-order-bashrc-zshrc-etc/

image

Another explanation: https://superuser.com/questions/183870/difference-between-bashrc-and-bash-profile/1136289#1136289

image

So this file would only be used in case a Bourne-like shell (eg. Dash) is start both as login and as an interactive shell.

Eg. by pointing your default user shell to Dash:

image

lazka commented 5 months ago

Thanks for the summary.

I checked what other distros provide, and Ubuntu adds a .profile which internally checks if it's run by bash, and Arch only adds a .bash_profile like us.

So in theory we could move new users to .profile instead like Ubuntu, but unless there are real problems that's probably not worth it.

sskras commented 5 months ago

Yes, there are many ways (at least some strategies) on how to implement that. Only a few of them are trying to be cross-platform compatible.


Eg. my own strategy is to create and maintain a set of these shell initialization dot-files so it (the set) works on a variety of platforms by rewriting (due to possible copyright issues) large parts of their default files:


I guess being compatible with at least some of these is a worth of a separate project. And yes, migrating from one existing layout to another one (like Arch => Ubuntu) would probably be an easier task.

Now I would do that only in case of migrating from Cygwin to a totally different runtime (like Midipix).