Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
suppress output from a command to STDOUT
Name: matt smith Date: May 15, 2002 at 14:45:55 Pacific
Comment:
I am running a cgi program on apache which runs an executable and assigns a variable to the output like this (in perl):
my $results = system "/usr/bin/exe $arg";
my problem is that this executable also tries to PRINT the results to STDOUT - this causes me problems because it either messes up my cgi headers or it messes up my HTML (depending on whether I print headers before or after I call the executable)
I have tried redirecting output to a file and that doesn't work either ex $results = system "/usr/local/exe $arg >> /tmp/file";
Name: junky_toof Date: May 15, 2002 at 15:01:08 Pacific
Reply:
ordinarily you would just do something like this: a = system("ls * 2&1 > /dev/null"); if (a != 0) { printf "%s", "Bogus run::program failed"; } else { EXIT_SUCCESS; }
YMMV, I tried it with awk and in C, and got different results depending on how I passed the command to execve. As ARGV[1] in awk it was almost impossible. In C it was trivial, so... BTW, I hate perl it's a write only language.
thanks for the help - i did try redirection to /dev/null and it still wanted to print -> the kludge i ended up with was embedding the return garbage in a META tag - it still prints but now, no one has to look at it! :-)
Summary: There is not one command. You would need to use various commands either in a script(batch file) or on a single line that takes the output from one function to the input of the next. There are many wa...
Summary: I was curious on how to add the option of booting from a cd to lilo. I know alittle about lilo but am not entirely sure. I have Mandrake 8.1, could I just edit /etc/lilo.conf file and add this line: o...
Summary: I'm downloading the iso image from a site to my W2K platform and using Adaptec CDCreator to burn. I'm doing something wrong in the burn process, I believe because the CD will not boot. When I look a...