I would like to forward the output from one script to the another.
I try to do it like that:
./producer.py > ./consumer.py
Where procuder:
#!/usr/bin/env python3
import sys
import time
i=0
while True:
print(i)
i+=1
time.sleep(1)
And consumer:
#!/usr/bin/env python3
import sys
f= open("test.txt","w+")
while True:
line = sys.stdin.read()
print(line)
f.write(line)
I expect that producer will generate: 1 2 3 4 5 and this pipe will be saved in file test.txt by another script. Thank you for help.