440Forums.com  |  MacMusic.org  |  PcMusic.org  |  Zicos.com  |  AudioLexic.org
shell   {key13}


How to capture output from certain Unix commands

MacOsxHints

Thursday May 1, 2008. 04:30 PM
MacOsxHints

I was recently trying to do some simple shell scripting with the command httpd -t, which runs a syntax check on the Apache configuration files. If everything is OK, it returns Syntax OK, otherwise, it will try to tell you what's wrong with the files. I wanted to grab the output of the syntax check and display it in my script, but wasn't having any luck -- any attempt to redirect the output, or assign it to a variable, resulted in nothing (empty variable, empty file, etc.). Unix wizards can stop reading this hint now, for I'm sure you know what the problem is...After much Googling, I discovered that some Unix commands create their output by writing to standard error (STDERR) instead of standard output (the Terminal window, typically). As a result, operations that capture standard output won't work for these types of messages, even though the message itself is displayed in the Terminal window. I found the solution in the ...
recently trying some simple shell scripting with command httpd which runs synt capture output from certain Unix commands
How to capture output from certain Unix commands Read more at MacOsxHints
feeds.macosxhints.com/~r/macosxhints/recent/~3/281481035/article.php

 

 Related News 

Search

Mac Zicos
Fri July 4, 10:37 PM
shell   {key13}