The net is full of suggestions e.g. https://unix.stackexchange.com/questions/26676/how-to-check-if-a-shell-is-login-interactive-batch
With that:
[[ $- == *i* ]] && echo 'Interactive' || echo 'Not interactive' >> /tmp/update-motd-test
shopt -q login_shell && echo 'Login shell' || echo 'Not login shell' >> /tmp/update-motd-test
In a test like:
ssh testuser1@10.253.194.246 "ls ~/"
It will detect:
Not interactive
Not login shell
If not in libpam we could clearly use this in the script snippets to fast-pass most of them.
Sadly above checks seem trivial I've found that they always report non-interactive/non-login even when being such. It seems the way this is executed prevents proper detection.
The net is full of suggestions e.g. https:/ /unix.stackexch ange.com/ questions/ 26676/how- to-check- if-a-shell- is-login- interactive- batch motd-test motd-test 10.253. 194.246 "ls ~/"
With that:
[[ $- == *i* ]] && echo 'Interactive' || echo 'Not interactive' >> /tmp/update-
shopt -q login_shell && echo 'Login shell' || echo 'Not login shell' >> /tmp/update-
In a test like:
ssh testuser1@
It will detect:
Not interactive
Not login shell
If not in libpam we could clearly use this in the script snippets to fast-pass most of them. /non-login even when being such. It seems the way this is executed prevents proper detection.
Sadly above checks seem trivial I've found that they always report non-interactive