Date: Sun, 5 Jun 2016 22:36:32 +0200 From: Polytropon <freebsd@edvax.de> To: Baho Utot <baho-utot@columbus.rr.com> Cc: freebsd-questions@freebsd.org Subject: Re: sh[it] and What am I missing here? Message-ID: <20160605223632.e263d041.freebsd@edvax.de> In-Reply-To: <a822e1cb-f2f8-0e1b-99af-831dc9f51b9b@columbus.rr.com> References: <57544c10.90e58c0a.cacbc.62fd@mx.google.com> <cdf04501-79ef-9dbb-14f0-ed10a6d7241e@columbus.rr.com> <57545029.5060805@gmail.com> <6f157455-0bda-ef46-82dc-e97fb0c4a08b@columbus.rr.com> <5754550A.6020500@holgerdanske.com> <02a5bb3c-e19a-221c-d30f-0feacebbf928@columbus.rr.com> <20160605221320.ac3da346.freebsd@edvax.de> <a822e1cb-f2f8-0e1b-99af-831dc9f51b9b@columbus.rr.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 5 Jun 2016 16:21:19 -0400, Baho Utot wrote: > Looks like I need to reread how login/interactive shells are executed as > I don't remember when .profiles and .shrc are executed/read Oh, that's quite simple, if I remember correctly: For the C shell: /etc/csh.cshrc = global resource for all shells /etc/csh.login = global "auto-exec" for login shells /etc/csh.logout = global "auto-exec" at logout ~/.cshrc = user resource for all shells ~/.login = user "auto-exec" for login shells ~/.logout = user "auto-exec" at logout In .cshrc, you often find "if ($?prompt) then ... endif" blocks which make settings apply only for interactive shells (such as keyboard definitions, history settings or other things that do not matter for scripting); in such cases, $prompt is set. For sh: /etc/profile = global resource for interactive shells ~/.shrc = global resource for all shells ~/.profile = user resource for interactive shells For bash: ~/.bashrc = user resource for all shells ~/.bash_profile = same as .profile, but bash-specific Confusing... I hope I got it right this time. :-) Note that bash also reads sh's profile files. The files are in the corresonding shell's language. There also is a precedence in which order the files are read. Even though "read" and "execute" means the same for those files, there are suggestions to use, for example, .cshrc for settings such as prompt, history, aliases, path, mail ("internal stuff"), while .login is used to start actual programs, such as biff, mesg, fortune ("external stuff"). See "man csh", "man sh" and "man bash" for details. They contain more information about when a shell is considered an interactive or a login shell. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160605223632.e263d041.freebsd>