Sub-shell commands must be execute automatically within bash scripts.

It runs automatically then executing the sub-shell within the bash but it requires human interaction I want to execute it automatically within my bash script.

My main Bash Script command lists:


Sub-shell executes

Deploying Askbot - Django Q&A forum application
Problems installing? -> please email admin@askbot.org

To CANCEL - hit Ctr-C at any time

Enter directory path (absolute or relative) to deploy
askbot. To choose current directory - enter "."
> .

Please select database engine:
1 - for postgresql, 2 - for sqlite, 3 - for mysql, 4 - oracle
type 1/2/3/4: 3

Please enter database name (required)
> askbotdb

Please enter database user (required)
> askbotuser

Please enter database password (required)
> askbotpasswords

Copying files:
* __init__.py
* manage.py
* urls.py
* django.wsgi
Creating settings file
settings file created

I want to automate given commands in myshell script so that it can run without human interaction.


Then what is command for my sub shell for above commands after askbot-setup commands for Bash script.

closed as unclear what you're asking by jasonwryan, enzotib, Eric Renouf, GAD3R, Kusalananda Jan 7 '17 at 21:26

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Have you tried using redirects, be it pipes or a <<< string redirect (which could be defined in a variable, e.g. var=".\n3\naskbotdb\naskbotuser\naskbotpasswords"; askbot-setup <<< $var)? – Kenneth B. Jensen Jan 7 '17 at 18:29
  • please tell me procedure – Gopal Raha Jan 7 '17 at 18:30
  • @Gopal this doesn't match what you wrote in your question – roaima Jan 7 '17 at 18:43
  • @roaima sorry please tell me solution how to run automatically those commands on by one in sub-shell – Gopal Raha Jan 7 '17 at 18:44
  • The first comment shows you how to do it. But the information you then provided doesn't match what you first wrote. Right now it's impossible to help you because you're giving us inconsistent information. – roaima Jan 7 '17 at 18:51

I`d look at the askbot documentation first and check if askbot-setup can get its answers from the command line or via some form of an answer file.

If all else fails you can use autoexpect(1) to create an expect(1) script to simulate your manual interaction with askbot-setup.

Just to avoid confusion of terms - "subshell" typically refers to a set of commands inside a shell script that get executed in a separate process space because of being surrounded by brackets. The kind of software you are referring to here is better described as an interactive installation script.

  • Sorry for incorrect tags.I have referred the askbot-setup above and commands are below. you can check above. please help me to automate those commands in bash scripts. – Gopal Raha Jan 7 '17 at 19:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.