Results 1 to 2 of 2
Hi! I'm having some trouble finding out how to control the output being printed to the screen from my scripts. I've tried looking for answers online, but I still get ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 10-16-2012 #1
- Join Date
- Oct 2012
Why does my script output to the terminal when I want to store it?
I'm having some trouble finding out how to control the output being printed to the screen from my scripts. I've tried looking for answers online, but I still get surprises sometimes when I run my scripts.
I'm trying to do continuous integration on the remote server, and the only way I know of returning values to say what builds failed is by printing text to the terminal, so it's pretty important that I have control over what gets printed.
As of now, I'm first running a perl script that passes another script to a server over ssh. This new script uses the system command to set a view (I believe this "set view" command creates a sub shell) and then build some projects.
From what I can tell, when I store the output of this command in an array, nothing gets printed if it builds without error, although text does get printed if I run the command directly from the terminal on the remote server. If it fails, the text seems to print, even if I never run a print command in my script.
My question is, what is the connection between text being printed to the terminal, and storing the results of a command into an array locally, over SSH and when running a sub shell?
Thank you for your time!
- 10-16-2012 #2
- Join Date
- Aug 2006
Did you read about STDIN, STDOUT and STDERR ? This is rather standard and may help to solve your problem, by directing the correct files to the correct devices.