Search code examples
scriptingcshtcsh

transferring via pipeline


I need to transfer data via pipe and also transfer file with this data, can I do something like this inside the script?

cat ${1} | ./helper ${1}

and what is the difference if I write

cat ${1} | ./helper < ${1}

Solution

  • "<" adds the file content to your scripts stdin

    pipe also redirects the output for stdin of the ./helper script

    you could eithe do cat ${1} | ./helper or ./helper < ${1} assuming ${1} is a filename and in helper script access it from /dev/stdin