Avoid interactive mode in shell script

scripting, shell

Solution

Closing `stdin` should do the trick:

exec <&-

Problem

There is an interactive shell console, I can get into it, run specific set of commands inside the console and exit from it. Now I want to write a bash script that connects to an interactive shell console and runs my commands silently, exits at the end without any interaction. This means I want to have everything automated in a non-interactive way. Any ideas how can I achieve this? I am trying something like, say, blabla shell is the interactive console here, it always bring me to the interactive mode :( ``` /usr/bin/blabla shell << EOF do A, do B, do C quit EOF ``` I have a long/specific version of this question can be found here -> Configure flume in shell/bash script - avoid interactive flume shell console

Original source