I think I understand the differences between an interactive, a login and a batch shell. See the following links for more help:
- What is the difference between a 'Login' and an 'Interactive' bash shell (from the sister site: Server Fault)
- Difference between Login Shell and Non-Login Shell?
- 2.1: Types of shell: interactive and login shells (from A User's Guide to the Z-Shell)
My question is, how can I test with a command/condition if I am on an interactive, a login or a batch shell?
I am looking for a command or condition (that returns true
or false
) and that I could also place in an if
statement. For example:
if [[ condition ]]
echo "This is a login shell"
fi