Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tricky echo and return 1

Status
Not open for further replies.

simanek

Programmer
Jan 19, 2001
137
US
I have some data that I need processed and in order to process it, it has to run through 3 scripts. These scripts are all modular enough where you just pipe the output from one to the next. So now, I want to get the result of this system("echo \"$var1, $var2\"" | script1.pl |script2.pl |script3.pl") statement and return it as html. Problem being is that 'system' returns error codes. Any ideas as to how to get this done? Thanks.

Mike
 
If you want to get the results of a system command passed back to your program, you should use backticks (
Code:
@results = `command`
) or open the command as a pipe and read it. I think the reason your system command is giving an error is because you've got a quote in the wrong place. You've got an extra quote after the echo statement that is closing the string to the system command, and another hanging quote at the end of the whole thing. If you've got quotes in a string it's much easier to use the qq generic quoting mechanism:
Code:
system(qq[echo "$var1, $var2" | script1.pl |script2.pl |script3.pl]);
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top