Error messgaes can not be redirected


 
Thread Tools Search this Thread
Operating Systems Solaris Error messgaes can not be redirected
# 1  
Old 11-13-2009
Error messgaes can not be redirected

# whoami 2>/dev/null
whoami: not found
#



Why the error message not getting redirected to /dev/null ...

The shell is
# echo $SHELL
/sbin/sh

For other commands it is working
# ls aaa 2>/dev/null
#


Is there any other way to redirect the err msg from whoami Thank you for your help....
# 2  
Old 11-13-2009
Redirect where?
# 3  
Old 11-13-2009
Debian

Quote:
Originally Posted by incredible
Redirect where?
Nowhere, that's a common usage.
Quote:
Originally Posted by Anu_1
# whoami 2>/dev/null
whoami: not found
#



Why the error message not getting redirected to /dev/null ...
Because the shell, not whoami is sending an error message.
Quote:
Is there any other way to redirect the err msg from whoami Thank you for your help....
That way:
Code:
{whoami} 2>/dev/null

# 4  
Old 11-13-2009
$ {whoami} 2>/dev/null
{whoami}: not found
$

Didn't work.....I do not want the error message on the screen......
# 5  
Old 11-13-2009
Code:
(whoami)2>/dev/null

Oops, you're missing a few characters in the previous post:

Code:
{ whoami;} 2>/dev/null

The correct syntax is:

Code:
{ <command>;}


Last edited by radoulov; 11-13-2009 at 10:11 AM..
# 6  
Old 11-13-2009
Indeed, I missed the semicolon in my previous answer.

Thanks
# 7  
Old 11-16-2009
Thank you all ....this worked....!!
Just for my knowledge .....to redirect the error msg of other commands to /dev/null....the syntax is <command> 2>/dev/null ....why the same syntax didn't work for Solaris... and we need to use { <command> ;} 2>/dev/null

Thanks for your answer....
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Deleting redirected pwd from file.

Hi echo " username " read username echo "password" stty -echo read password stty echo through read i am taking standard input and redirecign them to a file echo " username=${username}/${password} " > file.lst now from the same shell script i want to delete the password (i.e... (4 Replies)
Discussion started by: rosheks
4 Replies

2. AIX

Message redirected from syslog

Hi. recently in many of our lpars we are getting a message in errpt as "C6ACA566 0315094014 U S dtc MESSAGE REDIRECTED FROM SYSLOG". I have also checked the /etc/syslog.conf file. It doesn't point to error log. Can someone please advise about how to fix this error ? pmut3:/> errpt -aj... (4 Replies)
Discussion started by: newtoaixos
4 Replies

3. Shell Programming and Scripting

How get program name that produced an IO error redirected to a LOG in a nohup command?

Good afternoon, I'm have program that executes in background another programs. The main program would be programA and the programs executed by the main one, would be program1a, program1b and program1c. I need the programs to continue the execution no matter if the shell connection is lost,... (6 Replies)
Discussion started by: enriquegm82
6 Replies

4. UNIX for Dummies Questions & Answers

redirected output not going to file for all cases

I have to confirm that an engine was not able to run. In the output below you see that it indeed got errors, but it didn't send those messages to the output file. When I run the same thing with a different executable it works. So does this mean something in the executable could cause it not to... (7 Replies)
Discussion started by: brdholman
7 Replies

5. Solaris

stdout redirected?

Hi all, I have a c++ program which is running fine but has some printfs which its spews on to the screen, which I need for debugging. But, I execute this program through a java, i.e I run a java program which actually launches my c++ executable and when it does this, I see none of my printfs... (1 Reply)
Discussion started by: Naanu
1 Replies

6. UNIX for Dummies Questions & Answers

find cannot be redirected to specific stdout ?

I tried to redirect the find command to a file (using find ..... > asdf ) and the file asdf is always empty . The results keep appearing on the screen. Is there another way to do this ? hmm . i just figured out that the file is empty only when in fact all results of the find command give a... (1 Reply)
Discussion started by: Shady_Creeper
1 Replies

7. Shell Programming and Scripting

redirected output

Hello Everyone, I have an option for users in my shell script to create log file. So if user saying “yes” on it, I'm redirecting all output to log file by doing this: > /output.log. However I would like the output being displayed on the screen at the same time. Is it possible? If yes, does anybody... (2 Replies)
Discussion started by: slavam
2 Replies

8. UNIX for Dummies Questions & Answers

Standard output not redirected from /bin/sh

I have an application which has a lot of cout & cerr statements. This application also opens a log file (for eg a.log). When this application is run from the inittab file as follows /bin/sh -c " . /etc/timezone; exec /test" all the cout & cerr statements are printed in the log file... (1 Reply)
Discussion started by: soorajmu
1 Replies

9. UNIX for Dummies Questions & Answers

Entries in /var/log/messgaes

Hi all I am getting a repeated message in the /var/log/messages log. Oct 23 10:52:00 hostname xinetd: refused connect from xxx.yyy.zz.aa Oct 23 10:57:26 hostname xinetd: refused connect from xxx.yyy.zz.aa The IP is pretty much the same. The last part of the IP has changes a few times making... (1 Reply)
Discussion started by: skotapal
1 Replies

10. UNIX for Dummies Questions & Answers

Saving a redirected file

What command do I use in order to save a file in directory A/B/C to directory A/D/E. (1 Reply)
Discussion started by: JSP
1 Replies
Login or Register to Ask a Question