Fixed execution for non interactive shell

Added check for interactive terminal. If the terminal is interactive
then prompt is shown.