Operating System - HP-UX
1753875 Members
7827 Online
108809 Solutions
New Discussion юеВ

annoying output from make_config

 
SOLVED
Go to solution
GXW_1
Frequent Advisor

annoying output from make_config

Hi,

I'm trying to script something which includes a make_config along the way, and I have used "2>&1 >> $logfile" at the end of my commands to hide all that stuff away.

Problem is whenever th script hits the make_config it spews the following message on screen despite me redirecting standard and error output?

"NOTE: make_config can sometimes take a long time to complete. Please be patient!"

Does anyone know how I can get rid of this message. The man page doesn't seem to suggest any "supress msgs" option. :-(
6 REPLIES 6
A. Clay Stephenson
Acclaimed Contributor

Re: annoying output from make_config

I suppose that I know when to fight battles and when to ignore gnats and this may well be one of those times. Normally, when a message is not written to stdout or stderr and is still displayed on the terminal, the developer had a very good reason for doing that. He is probably writing to /dev/tty. The only file descriptors that you have control over before a process begins are 0,1, and 2 and make_config is obviously using another file descriptor.
If it ain't broke, I can fix that.
GXW_1
Frequent Advisor

Re: annoying output from make_config

FYI, I have resolved this issue by using backquotes...

...
blackhole=`/opt/ignite/bin/make_config -s $source -c $newconfig 2>&1 >> $logfile`
...

It probably is writing to another file descriptor but at least the above works.
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: annoying output from make_config

Since your backticks fixed the problem that means that the output is going to stdout in this case rather than directly to /dev/tty.

The problem is this:

"2>&1 >> $logfile"

restate it as

>> $logfile 2>&1

and you should be fixed.

By the way, backticks are considered archaic so that
XX=`command`
is better stated
XX=$(command)
If it ain't broke, I can fix that.
GXW_1
Frequent Advisor

Re: annoying output from make_config

oops :-(

You are, of course, spot on Clay.

This was just a silly output redirection mistake, although I did learn a few things fixing it!

Thanks.
GXW_1
Frequent Advisor

Re: annoying output from make_config

P.S. I am considered archaic ;-)
GXW_1
Frequent Advisor

Re: annoying output from make_config

See above for solution.