822 shaares
10 private links
10 private links
(...) when you are typing at a prompt and waiting for each command to run, the shell is interactive; in the other case, when the shell is reading commands from a file, it is, consequently, non-interactive.
Interactive = has a prompt waiting to read commands from input, instead of reading from a file
(...) the programme that logs you in after you type your password (called, predictably, login), actually sticks a
-in front of the name of the shell, which zsh recognises. The other way of making a shell a login shell is to run it yourself with the option -l; typing `zsh -l' will start a zsh that also thinks it's a login shell
So, if it looks like -zsh then it’s a login shell.
if [[ -o login ]]; then
print yes
else
print no
fi