shopt-option

login_shell

Read-only option indicating login mode; query returns zero when enabled.

Formal Syntax & Structure

bash syntaxbash
shopt -q login_shell

Return Value

exit status

Read-only option indicating login mode; query returns zero when enabled.

Working Example

Example Snippetbash
bash --noprofile --norc -c 'if shopt -q login_shell; then echo login; else echo nonlogin; fi'bash --noprofile --norc --login -c 'if shopt -q login_shell; then echo login; else echo nonlogin; fi'
Bash Reference