Reputation: 488
I began a project. In the instruction, it is written that we could test our program with this command line :
cat test.txt > test.py
But I have no output. As I understood, it is supposed to give me an output.
test.txt file looks like :
1
3
4
2
5
6
7
1
1
8
9
3
4
5
1
-1
And the test.py file looks like :
for i in range(16):
var=raw_input("type something : ")
print var
I was excepting this command line to redirect the content of the test.txt file to the test.py file while it was running.
I have already read the documentation about the cat command.
Could you help me please ?
In other words, how the cat command is supposed to simulate the user ? I think I have to change something in my python file.
Thank in advance, Mff
Upvotes: 0
Views: 1909
Reputation: 2872
The problem here is that you want cat test.txt | test.py
rather than >
. |
sends the output of one command (cat test.txt) to the input of the other (test.py) whereas >
sends the output to a file (which probably means you've overwritten test.py with the contents of test.txt).
Upvotes: 6