03-06-2009
Since it is the program that controls the opening and closing of its output files, no.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
In bash, I need to send the STDOUT and STDERR from a command to one file, and then just STDERR to another file. Doing one or the other using redirects is easy, but trying to do both at once is a bit tricky. Anyone have any ideas? (9 Replies)
Discussion started by: jshinaman
9 Replies
2. Shell Programming and Scripting
Is there a way to redirect all stdout to a file implicitly - like defining stdout=/home/me/process.log - so that all "echo" commands in several scripts/subscripts are written to that file; instead of having to edit all scripts to redirect the "echo" (e.g. echo 'This is a test ' >>... (1 Reply)
Discussion started by: ALTRUNVRSOFLN
1 Replies
3. Shell Programming and Scripting
Hi,
I am trying to execute a command like this:
find ./ -name "*.gz" -exec sh -c 'zcat {} | awk -f parse.awk' \; >> output
If I want to print the filename, i generally use the -print argument to the find command but when I am redirecting the output to a file, how can I print just the... (2 Replies)
Discussion started by: Legend986
2 Replies
4. Shell Programming and Scripting
can anyone help me in making singleline command for
Capital Letters are folders ,small letter are files
X,Y,Z are subfolders of A
as shown below
A - X,Y,Z
Folder X has three files a.txt,b.txt,c.txt similarly Y,Z.
as shown below
X- a.txt,b.txt,c.txt
Y- a.txt,b.txt,c.txt
Z-... (4 Replies)
Discussion started by: phoenix_nebula
4 Replies
5. UNIX for Dummies Questions & Answers
Hi all,
I've been looking around for this for a while and can't seem to find a satifactory way to do what I want:
I would like to assign the output of stdout to a variable and that of stderr to another one, and this without using temporary files/named pipes. In other words be able to assign... (4 Replies)
Discussion started by: anthalamus
4 Replies
6. Shell Programming and Scripting
Hello,
I have a script (videostream.sh) which invokes the GStreamer command-line tool gst-launch with all the correct command line parameters. When I invoke this program, I add the '&' character at the end to make it a background task, so that my script can complete and exit, i.e.
gst-launch... (1 Reply)
Discussion started by: salukibob
1 Replies
7. Shell Programming and Scripting
I have a simple bash script that prints sth every 5 seconds. What I do is the following. I redirect the output of the script to a file, tail the file and see that it works and then from another console I delete the file where the output is redirected to. Even though I have deleted the file, the... (2 Replies)
Discussion started by: igurov
2 Replies
8. Shell Programming and Scripting
I have a C program that continously outputs info to stdout. The problem is that I am redirecting the stdout and stderr to a file and stdout is written at the end of the problem rather than continously to the file. This could be a problem if for example the program is killed and the stdout output is... (3 Replies)
Discussion started by: igurov
3 Replies
9. Shell Programming and Scripting
Hello,
I'm strugling with some redirecting and all help is apreciated.
The following program is working as expected, but the result of the AT command doesn't go to any file.
Thanks in advance for the help.
#!/bin/bash
modem=/dev/ttyUSB1
file=/root/imsi.txt
# print error to stderr and exit... (4 Replies)
Discussion started by: cleitao
4 Replies
10. Shell Programming and Scripting
Well.. let's say i need to write a pretty simple script.
In my script i have 2 variables which can have value of 0 or 1.
$VERBOSE
$LOG
I need to implement these cases:
($VERBOSE = 0 && $LOG = 0) => ONLY ERROR output (STDERR to console && STDOUT to /dev/null)
($VERBOSE = 1... (5 Replies)
Discussion started by: Marmz
5 Replies
LEARN ABOUT POSIX
getprotobynumber
ENDPROTOENT(P) POSIX Programmer's Manual ENDPROTOENT(P)
NAME
endprotoent, getprotobyname, getprotobynumber, getprotoent, setprotoent - network protocol database functions
SYNOPSIS
#include <netdb.h>
void endprotoent(void);
struct protoent *getprotobyname(const char *name);
struct protoent *getprotobynumber(int proto);
struct protoent *getprotoent(void);
void setprotoent(int stayopen);
DESCRIPTION
These functions shall retrieve information about protocols. This information is considered to be stored in a database that can be accessed
sequentially or randomly. The implementation of this database is unspecified.
The setprotoent() function shall open a connection to the database, and set the next entry to the first entry. If the stayopen argument is
non-zero, the connection to the network protocol database shall not be closed after each call to getprotoent() (either directly, or indi-
rectly through one of the other getproto*() functions), and the implementation may maintain an open file descriptor for the database.
The getprotobyname() function shall search the database from the beginning and find the first entry for which the protocol name specified
by name matches the p_name member, opening and closing a connection to the database as necessary.
The getprotobynumber() function shall search the database from the beginning and find the first entry for which the protocol number speci-
fied by proto matches the p_proto member, opening and closing a connection to the database as necessary.
The getprotoent() function shall read the next entry of the database, opening and closing a connection to the database as necessary.
The getprotobyname(), getprotobynumber(), and getprotoent() functions shall each return a pointer to a protoent structure, the members of
which shall contain the fields of an entry in the network protocol database.
The endprotoent() function shall close the connection to the database, releasing any open file descriptor.
These functions need not be reentrant. A function that is not required to be reentrant is not required to be thread-safe.
RETURN VALUE
Upon successful completion, getprotobyname(), getprotobynumber(), and getprotoent() return a pointer to a protoent structure if the
requested entry was found, and a null pointer if the end of the database was reached or the requested entry was not found. Otherwise, a
null pointer is returned.
ERRORS
No errors are defined.
The following sections are informative.
EXAMPLES
None.
APPLICATION USAGE
The getprotobyname(), getprotobynumber(), and getprotoent() functions may return pointers to static data, which may be overwritten by sub-
sequent calls to any of these functions.
RATIONALE
None.
FUTURE DIRECTIONS
None.
SEE ALSO
The Base Definitions volume of IEEE Std 1003.1-2001, <netdb.h>
COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol-
ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE
and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained
online at http://www.opengroup.org/unix/online.html .
IEEE
/The Open Group 2003 ENDPROTOENT(P)