I am running python program from terminal
python -i abc.py <test.txt
python -i abc.py
for i in line:
for j in i[ind+1:]:
I want to buy Car for $10000
You redirect the stdin, so when the file ends, the process exits.
What you is read from the file first, then from stdin:
(cat test.txt && cat) | python -i abc.py
Without any arguments, cat reads from stdin. So in this case, the python process first receives this output of
cat test.txt and then the output of just
cat, which is stdin.
Note that this does not behave exactly the same as using
python -i abc.py without the redirect.