Today (Saturday) We will make some minor tuning adjustments to MySQL.

You may experience 2 up to 10 seconds "glitch time" when we restart MySQL. We expect to make these adjustments around 1AM Eastern Daylight Saving Time (EDT) US.


Suppressing errors from command output


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
Suppressing errors from command output

Hi,

When I run the command "print_manifest | grep "Main Memory", I get the note :

Code:
# /opt/ignite/bin/print_manifest | grep "Main Memory"
NOTE: Could not read the /etc/resolv.conf file.
    Main Memory:        196498 MB
#

How do I suppress the part :

NOTE: Could not read the /etc/resolv.conf file.

The file /etc/resolv.conf does not exist in the server, because we do not use DNS for our hostname resolution. However, this NOTE does not pop once I create the resolv.conf file. But is this a good solution?

Please advise.
# 2  
Did you consider redirecting stderr to /dev/null?
# 3  
Hi,

The script expects to see the resolve.conf file, so is correctly identifying the missing file - touching the file removes the error.

There are a number of options, the simplest is probably to do;

Code:
touch /etc/resolv.conf
chmod 440 /etc/resolv.conf

Alternatively you could send the stderr to /dev/null

Your final option would be to modify the script and put the offendin part of the script inside a test condition - running if the resolv.conf file exists.

Regards

Gull04
This User Gave Thanks to gull04 For This Post:
# 4  
I tried these methods to redirect stderr to /dev/null, and still that message pops :

Code:
$ sudo print_manifest | grep "Main Memory" > /dev/null 2>&1
NOTE: Could not read the /etc/resolv.conf file.
$ sudo print_manifest | grep "Main Memory" &>/dev/null
[1]     7684
$ NOTE: Could not read the /etc/resolv.conf file.
    Main Memory:        196498 MB

Are the commands I am using above correct?
If so, then seems like redirecting the error wont work. Need to touch the file?
# 5  
You are piping the command's stdout to grep and then redirecting grep's stderr to the null device. Where does the command's stderr go to?

EDIT: Alternatively, make it all a "compound command":
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
errors from output /usr/bin/last
Bill L.
for ga016dgf -> /usr/bin/last | cut -c1-3 Invalid record size. Unable to continue ... any ideas? running on ga016dgf -> uname -a HP-UX ga016dgf B.11.31 U ia64 1246079591 unlimited-user license thank you. Video tutorial on how to use code tags in The UNIX and Linux Forums.... HP-UX
4
HP-UX
Suppressing output of a spawned telnet process
arun_maffy
Hi, I'm trying to spawn a telnet process and trying to do some actions in the remote host using expect script. I would like to know how to suppress all the output in order the user using the script should not be able to see any actions done on the remote host. I tried using the "log_user 0"...... Shell Programming and Scripting
8
Shell Programming and Scripting
Suppressing the automatic output of "script"
ggayathri
Is there a way to suppress the output that script command displays - "Script command started..."... Shell Programming and Scripting
4
Shell Programming and Scripting
suppressing an error message using the "ls" command
basher400
hi I'm new here so my question maybe be retarded or out of place: Is there a way to suppress the "No such file or directory" error message when using the "ls" command ? thanks... UNIX for Dummies Questions & Answers
5
UNIX for Dummies Questions & Answers
Suppressing output to the screen
rolex.mp
I want to check whether the variable read from the console is number or character , so i used echo $option|grep and checked the reuslt returned by grep cmd using $? But since I use echo the value is getting printed in the screen , I want to supress the o/p. Can anyone suggest how this can be...... UNIX for Dummies Questions & Answers
1
UNIX for Dummies Questions & Answers

Featured Tech Videos