csh stdin to Python stdin?
Question: How do you redirect the stdin of a csh script to the stdin of a python script?

I have a cgi script I'm writing in csh that runs on a Solaris machine. This
csh script is a wrapper to a python script that reads from the stdin (I know,
scripting in csh is bad but I'm forced to in this case).

Thanks for help! (And sorry for the n00b question!)


Answer: test.csh

    
    
    #!/bin/env csh
    python test.py
    

test.py (see [this question](http://stackoverflow.com/questions/1450393/how-
do-you-read-from-stdin-in-python))

    
    
    #!/bin/env python
    import fileinput
    
    if __name__ == '__main__':
        print "Hi. printing stdin"
        for line in fileinput.input():
            print line
    
        print "fin"
    

Then the stdin to `test.csh` is passed in to `test.py` [as Henning
said](http://stackoverflow.com/questions/7234640/csh-stdin-to-python-
stdin/7234676#7234676).

    
    
    echo "this is stdin" | csh test.csh
    

