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.
I suspect that manage.py is requesting more than one line of input. Is there a reason you can't use
python manage.py flush --no-input
as documented?
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.
This will work, assuming that the yes command is installed (it should be) :
yes yes | python manage.py flush
But as mentionned :
python manage.py flush --no-input
is probably better.
Most likely "python manage.py flush" expects additional input after reading "yes", which it doesn't get, because "echo "yes"" finishes and its output file is closed.
You need to figure out what else "python manage.py flush" expects and provide that on its input.