mindthump

interactive and/or login shell?

Sep 27th, 2023 (edited)
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. bash:
  2. [[ $- == *i* ]] && echo 'Interactive' || echo 'Non-Interactive'; shopt -q login_shell && echo 'Login' || echo 'Non-Login'
  3.  
  4. zsh:
  5. [[ -o interactive ]] && echo "Interactive" || echo "Non-Interactive"; [[ -o login ]] && echo "Login" || echo "Non-Login"
Advertisement
Add Comment
Please, Sign In to add comment