How to pass 'yes' to python manage.py flush?

bash, django, prompt

Solution

Reading your comments, it appears you want to get the first one automated, and then have it ask for the rest.

You may or may not have learned this from that link:

The manage script asks for input on stdin. Echo passes its output to its stdout, then closes.

You want to pass the echoed 'yes' to stdout, followed by reading from keyboard.

cat <(echo "yes") - | python manage.py

Will concatenate (output from one, then the next) the content of `echo yes` (pretending it's a file), followed by the content of stdin. As a result, you get the first automated answer, followed by a prompt for the rest.

Note that you can even do this more than once:

cat <(echo "yes") - <(echo "no") -

Will output "yes", followed by whatever you type in, until you end with ctl-d, followed by "no", followed by whatever you put in, until you end with ctl-d.

Problem

According to this StackOverflow thread about piping input, running `echo "yes" | command` should pass `yes` to the first prompt of a command. However, `echo "yes" | python manage.py flush` produces the error ``` EOFError: EOF when reading a line. ```

Original source

Related problems