Results 1 to 3 of 3
Hello,
Any ideas how to supress error output to console for cmd like finger from a shell script.
finger: connect: Connection refused
finger: connect: No route to host
(Any other ...
- 08-02-2007 #1Just Joined!
- Join Date
- Aug 2007
- Posts
- 1
How to supress Error output to console
Hello,
Any ideas how to supress error output to console for cmd like finger from a shell script.
finger: connect: Connection refused
finger: connect: No route to host
(Any other cmd equivalent to finger , which can help finding out ip of the machine on which a particular user is logged in !!)
Regards
AS
- 08-02-2007 #2Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
Hi,
Redirect the output of stderr (descriptor 2) to /dev/null:
RegardsCode:command 2>/dev/null
- 08-02-2007 #3
Yes. Do you know how to redirect normal output?
To redirect output, we do "COMMAND > FILE". The single '>' means erase this file, while a '>>' means append to this file.
The same applies to error redirecting, except that we need to prepend a '2'. This is because the stderr stream is stream 2.
So for instance:
/dev/null is a special file that simply ignores all content. So you can write to it if you want to just dispose of input.Code:finger idontexist 2> /dev/null
DISTRO=Arch
Registered Linux User #388732


Reply With Quote