An interactive shell is when bash is:
When invoking an interactive shell, you can set the positional parameters with the -s option of bash. See Bash - Bash cli
if [[ $- == *i* ]] then echo "Interactive" fi
where