02-17-2009
You can first call isatty() on each file descriptor: 0, 1 to see if it is a terminal or not.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
How can I redirect and append stdout and stderr to a file when using cron? Here is my crontab file:
*/5 * * * * /dir/php /dir/process_fns.php >>& /dir/dump.txt
Cron gives me an 'unexpected character found in line' when trying to add my crontab file.
Regards,
Zach Curtis
POPULUS (8 Replies)
Discussion started by: zcurtis
8 Replies
2. UNIX for Advanced & Expert Users
Hi all hope you can help as I am going MAD!!! :eek:
The below is in a shell script but the redirection in the sed line does not work and outputs to the screen and the $fname_2 does note get created ?????
Can any one help ??
#!/bin/ksh
cd /app/
for fname in `ls -1 X*`
do
sed 1d $fname... (3 Replies)
Discussion started by: mlucas
3 Replies
3. UNIX for Dummies Questions & Answers
Hi everyone!
Well, this is the thing.. I sent a process's stdout to /dev/null. This process
is very time consuming and after a week it keeps running, what I need is
to switch the stdout back to screen to see what's going on.
Anyone know if it's possible and how to do it?
Thanks and... (3 Replies)
Discussion started by: piltrafa
3 Replies
4. UNIX for Advanced & Expert Users
Hi all,
I have the following script:
-------------------------------------------------
#SCRIPT TO CHECK WHO HAS ACCESSED THE LOG/FILE IN PAST 'N' MINUTES, AND MAIL ACCORDINGLY.
MYPATH="/clocal/mqbrkrs/user/mqsiadm/sanjay/"
MAIL_RECIPIENTS="vg517@dcx.com"
Subject="File accessed in last... (6 Replies)
Discussion started by: varungupta
6 Replies
5. Shell Programming and Scripting
Hi friends
I am facing one problem while redirecting the out of the stderr and stdout to a file
let example my problem with a simple example
I have a file (say test.sh)in which i run 2 command in the background
ps -ef &
ls &
and now i am run this file and redirect the output to a file... (8 Replies)
Discussion started by: sushantnirwan
8 Replies
6. UNIX for Dummies Questions & Answers
I have put the file descriptor 1 to file, using command exec 1>>out.txt
Then I could not see any output on the screen, how could I restore the default output to terminal? :mad: Thanks (3 Replies)
Discussion started by: biglau
3 Replies
7. Programming
hello again!
i use dup2 to redirect stdout. I run what i want, now i want undo this redirection. how can i do that?
thanx in advance (7 Replies)
Discussion started by: nicos
7 Replies
8. Shell Programming and Scripting
Hi,
I would like to avoid re-directing line by line to a file.
What is the best way to re-direct STDOUT to a file in a subshell?
Thanks in advance.
Cheers
Vj (1 Reply)
Discussion started by: tnvee
1 Replies
9. Red Hat
EDIT: Nevermind, figured it out! Forgot to put backslashes in my perl script to not process literals!
Hi everyone. I am trying to have this command pass silently. (no output)
chsh -s /bin/sh news
Currently it outputs.
I've tried....
&> /dev/null
1> /dev/null
2>&1 /dev/null
1>&2... (1 Reply)
Discussion started by: austinharris43
1 Replies
10. Shell Programming and Scripting
Oracle Linux 5.6 64-bit (derivative of RHEL)
Dear Ann Landers,
This is about as bizarre as anything I've ever seen.
I have a little test script I've been working with. When I redirect stdout to a file, no file. Make a copy of the script to another name. Execute it and redirect stdout, and... (4 Replies)
Discussion started by: edstevens
4 Replies
LEARN ABOUT SUNOS
elf_errmsg
elf_errmsg(3ELF) ELF Library Functions elf_errmsg(3ELF)
NAME
elf_errmsg, elf_errno - error handling
SYNOPSIS
cc [ flag ... ] file ... -lelf [ library ... ]
#include <libelf.h>
const char *elf_errmsg(int err);
int elf_errno(void);
DESCRIPTION
If an ELF library function fails, a program can call elf_errno() to retrieve the library's internal error number. As a side effect, this
function resets the internal error number to 0, which indicates no error.
The elf_errmsg() function takes an error number, err, and returns a null-terminated error message (with no trailing new-line) that
describes the problem. A zero err retrieves a message for the most recent error. If no error has occurred, the return value is a null
pointer (not a pointer to the null string). Using err of -1 also retrieves the most recent error, except it guarantees a non-null return
value, even when no error has occurred. If no message is available for the given number, elf_errmsg() returns a pointer to an appropriate
message. This function does not have the side effect of clearing the internal error number.
EXAMPLES
Example 1: A sample program of calling the elf_errmsg() function.
The following fragment clears the internal error number and checks it later for errors. Unless an error occurs after the first call to
elf_errno(), the next call will return 0.
(void)elf_errno();
/* processing ... */
while (more_to_do)
{
if ((err = elf_errno()) != 0)
{
/* print msg */
msg = elf_errmsg(err);
}
}
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Stable |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
SEE ALSO
elf(3ELF), libelf(3LIB), attributes(5)
SunOS 5.10 11 Jul 2001 elf_errmsg(3ELF)