I'm running a script to bring down the logical ip address . But if the system doesnt have that logical ip addresss then i get the following error print on terminal -

SIOCSIFFLAGS: Cannot assign requested address

I just want to know whether there is a way to suppress that print so that user is not aware of that.
May be some check before pulling down the logical ip.

the script file content is -

ifconfig eth0:1 down

is there any syntax by which i can check whether eth0:1 is up or not .
My purpose is not to show the user that error msg and i wanna do it from the script file itself not modify some system files as i wouldnt know on which (linux) system the user will be excuting that script.

4 Years
Discussion Span
Last Post by L7Sqr

You can send error output to some specific location (usually, /dev/null) So something like:
ifconfig eth0:1 down 2>/dev/null
That will prevent error messages from being printed but will still allow any other output to be printed to the screen.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.