2

I'm trying to understand this shell cmd.

I understand that:

convox exec <pid> is going to execute the following cmd in the container with pid as the ID

< file.txt work redirects the content of file.txt file as input to the convox cmd

> file.txt overwrite the file context with whatever is on the left of that > redirect operator

Then the question is what does that cat - do? How does the content of my local file.txt get passed to the command that is going to run within the container?

1 Answer 1

2

The cat - > file.txt command is executed inside the container, while the < file.txt, which is outside of the quotes ("..."), affects the convox exec command itself.

In other words, this redirects stdin for the convox exec command from stdin, and then cat - > file.txt reads from stdin and writes to the file file.txt inside the container.

2
  • Thank you for the answer, I never seen the cat - syntax, is that part of shell or convox cmd? could you give me a link to some reference? I try to google it but didn't get anything.
    – Jerry
    Mar 27, 2019 at 12:07
  • 1
    cat is a standard unix command that reads one or more files and writes them to stdout. - is a special argument that means stdin. cat reads from stdin by default, so cat - > file.txt is equivalent to cat > file.txt.
    – larsks
    Mar 27, 2019 at 13:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .