# Checking whether shell is (non-)interactive

# if tty -s; then echo 'This is interactive shell.'; else echo 'This is non-interactive shell.'; fi

# Checking whether shell is (non-)login

# If output of echo $0 starts with -, it's login shell (echo $0 output example: -bash). Otherwise it's non-login shell (echo $0 output example: bash).

# if echo "$0" | grep -e ^\- 2>&1>/dev/null; then echo "This is login shell."; else echo "This is non-login shell."; fi;

# Let's combine the two above together to get both pieces of information at once:

# THIS_SHELL_INTERACTIVE_TYPE='non-interactive'; 
# THIS_SHELL_LOGIN_TYPE='non-login'; 
# if tty -s; then THIS_SHELL_INTERACTIVE_TYPE='interactive'; fi; 
# if echo "$0" | grep -e ^\- 2>&1>/dev/null; then THIS_SHELL_LOGIN_TYPE='login'; fi;
# echo "$THIS_SHELL_INTERACTIVE_TYPE/$THIS_SHELL_LOGIN_TYPE"


if tty -s; then echo 'This is interactive shell.'; else echo 'This is non-interactive shell.'; fi


if echo "$0" | grep -e "^\-" 2>&1 >/dev/null; then echo "This is login shell."; else echo "This is non-login shell."; fi
