08-18-2011
Note: This question is not AIX specific.
1 = stdout
2 = stderr
3 = user created file descriptor
.
common uses for 1/2 are to discard or log the output
examples
Quote:
/bin/foo >/dev/null 2>&1
/bin/foo >/dev/null 2>/tmp/stderr.log
/bin/foo > /tmp/foo.log 2>&1
/bin/foo > /tmp/stdout.log 2>/tmp/stderr.log
10 More Discussions You Might Find Interesting
1. Programming
Here is my problem. I don't know make this redirection thing work. The output file (called output.c) looks like this
#include<stdio.h>
int main()
{
int k;
int m;
print f("%d\n", k);
printf("%d\n", m);
return 0;
}
the input file(called input.c) is this
#include<stdio.h>
int... (2 Replies)
Discussion started by: Shallon1
2 Replies
2. Shell Programming and Scripting
Hi,
The code below works, it's a part of a bash shell script that serve to search a pattern $pattern_da_cercare in the files contained in a directory $directory_iniziale.
Now the proble is:
How can I redirect stderr to a file?
PS: so I want to redirect ALL the errors to a file.
I tryed... (9 Replies)
Discussion started by: DNAx86
9 Replies
3. Shell Programming and Scripting
hi all,
how to redirect the stdout msg in command line and file at the same time?
e.g
i got the script named test.sh, content as following:
#!/bin/sh
echo "111"
when i run the script ./test.sh > log.log, it will wirte the "111" into log.log, but how to show the "111" in command line... (2 Replies)
Discussion started by: eric_wong_ch
2 Replies
4. Shell Programming and Scripting
Hi,
I have a Perl script that finds some files based on some criteria and then it processes the file contents using some logic.
Extract:
print "Started ... ";
my $command = "<unix command>";
@arr=`$command`;
$size=@arr;
print "Size: ".$size
If I turn on the Perl debugging option then I... (3 Replies)
Discussion started by: King Nothing
3 Replies
5. UNIX for Dummies Questions & Answers
Hi Guys,
I m new to UNIX and new to this forum. Was wondering if someone can help me understand redirection (standard input output pipeline etc)
for starters, not too sure what this would mean
who | sort > sortedfile | pr | lp
im starting to understand common commands but when throwing... (2 Replies)
Discussion started by: jmack123
2 Replies
6. Shell Programming and Scripting
Hello everyone,I'm reading a book and there's code fragment:
exec 3>&1
ls -l 2>&1 >&3 3>&- | grep bad 3>&-
exec 3>&-
It says that the red part of that code does not close fd 3 but the green does close the fd 3.I can't understand that.....Why?Any predicate will be appreciated.:) (18 Replies)
Discussion started by: homeboy
18 Replies
7. Web Development
Hello
I have a domain where i need a redirection as described below :
i.e
mydomain.com/t-ABC-048796/sample.jpg
must redirect to
mydomain.com/jjj/top/8796/sample.jpg
As you can see from the source URL (mydomain.com/t-ABC-048796/sample.jpg) i need the last four characters... (2 Replies)
Discussion started by: unimaxlin
2 Replies
8. Shell Programming and Scripting
I want to redirect stderr and have the following peice of code
$ cat t1.ksh
#!/bin/ksh
func2()
{
diff /tmp/jdlkwjdlkejew /tmp/djlkwejdlewdjew >$OUTPUT_FILE 2>>$ERR_FILE
}
func1()
{
let counter=0
while
do
print -u2 "Error: In main function"
func2
let... (1 Reply)
Discussion started by: BeefStu
1 Replies
9. Shell Programming and Scripting
Hello All,
I am using the below script to gather various tools running by the user, we have more than 100 tools running on the server so my challenge is to redirect memory & cpu load to the file with the name of the tool.so am using the below script i am stucking how to redirect to the file... (2 Replies)
Discussion started by: ajaincv
2 Replies
10. Solaris
Hi
I am using solaris 10. When running a grep command with multiple files the output is the same as the order of the input. As soon as I pipe the output to another command then it seems that standard error takes precedence, over standard output and gets sent to the pipe first.
ie grep -c... (7 Replies)
Discussion started by: chronics
7 Replies
LEARN ABOUT DEBIAN
watchgnupg
WATCHGNUPG(1) GNU Privacy Guard WATCHGNUPG(1)
NAME
watchgnupg - Read and print logs from a socket
SYNOPSIS
watchgnupg [--force] [--verbose] socketname
DESCRIPTION
Most of the main utilities are able to write their log files to a Unix Domain socket if configured that way. watchgnupg is a simple lis-
tener for such a socket. It ameliorates the output with a time stamp and makes sure that long lines are not interspersed with log output
from other utilities. This tool is not available for Windows.
watchgnupg is commonly invoked as
watchgnupg --force ~/.gnupg/S.log
OPTIONS
watchgnupg understands these options:
--force
Delete an already existing socket file.
--tcp n
Instead of reading from a local socket, listen for connects on TCP port n.
--verbose
Enable extra informational output.
--version
Print version of the program and exit.
--help Display a brief help page and exit.
EXAMPLES
$ watchgnupg --force /home/foo/.gnupg/S.log
This waits for connections on the local socket '/home/foo/.gnupg/S.log' and shows all log entries. To make this work the option log-file
needs to be used with all modules which logs are to be shown. The value for that option must be given with a special prefix (e.g. in the
conf file):
log-file socket:///home/foo/.gnupg/S.log
For debugging purposes it is also possible to do remote logging. Take care if you use this feature because the information is send in the
clear over the network. Use this syntax in the conf files:
log-file tcp://192.168.1.1:4711
You may use any port and not just 4711 as shown above; only IP addresses are supported (v4 and v6) and no host names. You need to start
watchgnupg with the tcp option. Note that under Windows the registry entry HKCUSoftwareGNUGnuPG:DefaultLogFile can be used to change
the default log output from stderr to whatever is given by that entry. However the only useful entry is a TCP name for remote debugging.
SEE ALSO
gpg(1), gpgsm(1), gpg-agent(1), scdaemon(1)
The full documentation for this tool is maintained as a Texinfo manual. If GnuPG and the info program are properly installed at your site,
the command
info gnupg
should give you access to the complete manual including a menu structure and an index.
GnuPG 2.0.19 2014-06-26 WATCHGNUPG(1)