2

If I change my shell with chsh to a shell that I wrote myself, which scripts does it need to execute? I already tried changing to my own shell and surprisingly it worked without an error msg. Now does that mean that the login shell decides itself which scripts to run and there is no script that the login shell must run?

I thought that .login or .aliases or similar were always run.

2 Answers 2

3

The profile file is always run by login shell, and if you want other scripts to be sourced by the login shell, you mention them in profile

1

Depends on the design of your shell.

Does it follow the POSIX standard?

If Yes, then your shell needs to read the ENV environment variable at start of any interactive session and read/execute the content of the file(s) the ENV variable refers. No other file needs to be read as per the standard. This is a bare minimum for POSIX conformation as far as reading files while starting is concerned.

What about customization?

The thing is, most of the shells nowadays use specific files to read/source/execute while starting a session. Files differ for various session types. For example, bash sources the files /etc/profile and one of ~/.bash_profile, ~/.bash_login, ~/.profile (first one available following the order) while starting a login interactive session. Most popular shells do that too, but again this is a design decision, not a standard.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .