I'm new to shell-scripting and I guess this should be something quite easy. Anyway I don't know how to force redirect a program's output to the input of another program. I know about the pipe, where you can do
program1 | program2
But in my case, I guess the output of program1 is already redirected somewhere else (this is a long script that someone else wrote). When I tried on a separate command prompt, the result is as expected, but when I put it inside the script program2
gets upset about missing parameters. Can I somehow force it?
i'm afraid there is no easy answer to this. first of all you have to find where program1 is redirecting its output to. to give you some hints what to search for, take a look at this.
when you've found out, let program1 print to stdout. this way the output of program1 will get piped to the input of program2.
as you say "gets upset about missing parameters" it could also be, that program2 is not able to read all information from stdin. when you use the output of program1 as parameters to program2, try xargs: