views:

14

answers:

1

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}
A: 

"<" 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

Imre L