Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

There's a script I'm running that installs a service. It has a couple of read commands.

I'd like to run it as a part of a bigger installation script (actually capistrano but it doesn't matter), and prefill the "read" parts with values, instead of blocking the entire process.

The script runs with a single command, let's say blah/bin/blah install, I'd like to supply input on the command, like input first_input, second_input | blah/bin/blah install

Relevant parts of the script:

      if [[ $NEO4J_USER == $wrapper_user ]]; then

      ######### read:
      read -p "Graph-like power should be handled carefully. What user should run Neo4j? [$default_user] " proposed_user
      if ! `id $proposed_user &> /dev/null` ; then

      ######### read:
        read -p "User \"$proposed_user\" does not yet exist. Shall I create the account for you? [Yn]" yn
        case $yn in
          [Nn]* ) echo "WARNING: Alright, but Neo4j will fail to launch until that user has been created."
          set_user $proposed_user
        * ) create_user $proposed_user

The entire script is at

I know I can change the script but I just want to prefill the values. Is it possible?

Well, in fact, it did matter I use capistrano because it has the ability to send input (see &block section).

But it's interesting to know if the functionality I mentioned exists in bash as well.

share|improve this question
up vote 1 down vote accepted

read reads from stdin by default. Simply feed something there.

echo -e '\n\n' | blah/blah/blah install

blah/blah/blah install <<< $'\n\n'
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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