01-15-2009
Alright, so here is how error redirection works..
As you know, to send the STDOUT to /dev/null you do something like this: somecmd > /dev/null
So, to send STDERR to the same place, you can do:
somecmd 2> /dev/null
To send both STDOUT and STDERR to /dev/null you can do:
somecmd > /dev/null 2>&1
the 2 is writing to the same place that 1 is (which is dev null).. The &1 means "Whatever 1 is writing to".
Hopefully that explains it a bit better.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Maybe it's an stupid question but remeber... I'm Junior..
I use command line to run programs, and some of them gives a lot of information when, for example, you open a window or other actions. That's really bad because my terminal gets full of unwanted messages, so I use "bin file & >/dev/null"... (1 Reply)
Discussion started by: piltrafa
1 Replies
2. Shell Programming and Scripting
Working in a bash environment, in the following example, how do I direct the error message that putting in an invalid flag (-j for example) would normally produce to dev/null?
while getopts "abcd" opt
do
case "$opt" in
i) a etc ;;
r) b etc ;;
f) c etc ;;
v) d... (7 Replies)
Discussion started by: Sniper Pixie
7 Replies
3. UNIX for Dummies Questions & Answers
Is it possible to redirect errors at the command line when you run the script such as bash scriptname & 2>/dev/null? (1 Reply)
Discussion started by: knc9233
1 Replies
4. Solaris
Hi, Anyone can help
My solaris 8 system has the following
/dev/null , /dev/tty and /dev/console
All permission are lrwxrwxrwx
Can this be change to a non-world write ??
any impact ?? (12 Replies)
Discussion started by: civic2005
12 Replies
5. Shell Programming and Scripting
Hi expert,
May I know what is the difference between below cron tab entry ?
0,12 * * * * /abc/myscript.sh > /dev/null 2>&1
0,12 * * * * /abc/myscript.sh (7 Replies)
Discussion started by: olaris
7 Replies
6. UNIX for Dummies Questions & Answers
How are these two different? They both prevent output and error from being displayed. I don't see the use of the "&"
echo "hello" > /dev/null 2>&1
echo "hello" > /dev/null 2>1 (3 Replies)
Discussion started by: glev2005
3 Replies
7. Shell Programming and Scripting
I apologize if this question has been answered else where or is too elementary.
I ran across a KSH script (long unimportant story) that does this:
if ; then
CAS_SRC_LOG="/var/log/cas_src.log 2>&1"
else
CAS_SRC_LOG="/dev/null 2>&1"
fithen does this:
/usr/bin/echo "heartbeat:... (5 Replies)
Discussion started by: jbmorrisonjr
5 Replies
8. Shell Programming and Scripting
I'm using an text-to-speech synthesis in a script, and I need to redirect it's output to /dev/null
how can I do that ? And how to redirect the stream to his normal output then (sound card ) ?
thankx (2 Replies)
Discussion started by: firelink
2 Replies
9. Shell Programming and Scripting
Hello All and a Happy New year to yous guys.
I'm running the below command on my AIX box and it keeps giving me the message that the file doesn't exist. I know the file don't exist, but I don't want to see the error. 2>/dev/null doesn't work.
bash-3.00$ ls -l C* | wc -l 2>/dev/null
ls:... (2 Replies)
Discussion started by: bbbngowc
2 Replies
10. UNIX for Dummies Questions & Answers
Hello.
When I run a .ksh that contains the command below, and there is no file available in the source location the "FILE_NAME_*.CSV not found" error is still being displayed.
FILEN=$(ssh ${SOURCE_SERV} "cd ${SOURCE_LOCATION} ;ls ${FILES}") 2> /dev/null.
This is interfering with the rest... (4 Replies)
Discussion started by: jimbojames
4 Replies
LEARN ABOUT DEBIAN
rant-import
rant-import(1) rant-import rant-import(1)
NAME
Rant - Flexible, Ruby based make
SYNOPSIS
The rant-import command creates a monolithic rant script tailored to the needs of your project and thus removes the dependency on an Rant
installation (but of course one person needs an Rant installation to run rant-import).
Run the command with the --help option to get a brief help message:
% rant-import --help
Probably the easiest way to create your monolithic rant script is with the --auto option:
% rant-import --auto ant
This will write a monolithic rant script to the file ant in the current directory. To determine which plugins and imports your project is
using, it performs step 2 of the rant command as described in doc/rant.rdoc, which means that it loads the Rantfile in the current direc-
tory.
That one command should be enough:
% ruby ant
This script has the same behaviour as the rant command. Distribute it with your project and nobody else but you needs an Rant installation.
FURTHER INFORMATION
For more information on Rant see: <http://make.rubyforge.org/>
<http://make.rubyforge.org/files/doc/rant-import_rdoc.html>
AUTHOR
Rant is by Stefan Lang
This package is maintained by Ralph Amissah
SEE
rant(1)
version 0.5.6 July 26, 2006 rant-import(1)