Closed asd-a closed 5 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/
Another explanation: https://superuser.com/questions/183870/difference-between-bashrc-and-bash-profile/1136289#1136289
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:
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.
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).
i add
echo 1
to ~/.profile, but there is no difference