Sponsored Content
Top Forums Shell Programming and Scripting How to redirect std out and std err to same file Post 302078808 by 0ktalmagik on Tuesday 4th of July 2006 06:11:01 PM
Old 07-04-2006
How to redirect std out and std err to same file

Hi

I want both standard output and standard error of my command cmd to go to the same file log.txt. please let me know the best commandline to do this.

Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to redirect std err and out to log file for multi-commands?

The following command does not work under cygwin bash. ant debug >log 2>&1 && ant image >>log 2>>&1 & pid=$! It gives the error "-bash: sysntax error near unexpected token '&'". Is there a way I can redirect std output and std error to file "log" for both the commands "ant debug" and "ant... (1 Reply)
Discussion started by: siegfried
1 Replies

2. Programming

Sun Studio C++ - Getting error in linking std::ostream &std::ostream::operator<<(std:

Hello all Im using CC: Sun C++ 5.6 2004/07/15 and using the -library=stlport4 when linkning im getting The fallowing error : Undefined first referenced symbol in file std::ostream &std::ostream::operator<<(std::ios_base&(*)(std::ios_base&))... (0 Replies)
Discussion started by: umen
0 Replies

3. Shell Programming and Scripting

redirecting std error

Hi, I use the following command make all > output-`date +%F-%H-%M-%S`.txt 2>&1 to invoke a MAKE process that takes some weeks to complete. The ouput is redirected to a text file. Now I prefix the above command with time to get time needed for completion of the MAKE process time make... (2 Replies)
Discussion started by: gkamendje
2 Replies

4. AIX

Redirecting Both to a file and std output

Hello Friends, Can some one help me how to redirect output of a file to both a file and std output? All the help would be greatly appreciated. Regards Sridhar (1 Reply)
Discussion started by: send2sridhar
1 Replies

5. UNIX for Advanced & Expert Users

redirect to both file and std output at the same time

hello can some one please help me to redirect the output of a command to both std output and a file. this is little urgent. sridhar (2 Replies)
Discussion started by: send2sridhar
2 Replies

6. Shell Programming and Scripting

Help with Getopt::Std

I am working on a script that lists files in a directory with a few file attributes depending on what option the user specifies at the command prompt. The script uses Getopt::Std and takes two switches. The first switch allows the user to specify a directory, the second switch gives a long... (3 Replies)
Discussion started by: Breakology
3 Replies

7. Shell Programming and Scripting

Ksh script: std Out/err

Hello gurus, this is part of my script: ls -1 ${MyFile} >> ${dir_log}ListFile${Now}.tmp FILENUM=`cat ${dir_log}ListFile${Now}.tmp| wc -l | awk '{print $1}'`>> /dev/null if then writeError "ERRORE: no file in directory for type ${FileName}!" >> ${LogFileName} Close 1 fi... (7 Replies)
Discussion started by: GERMANICO
7 Replies

8. Shell Programming and Scripting

password file as std input to script

I'm a fairly new AIX admin (disclaimer). We have SQL scripts written by end users that use a userid and passwd to connect to our DB2 database. Is it possible to create an "input file" that contains the db2 connect parameters and yet secure the file from the SQL creator? i.e., they can "use"... (2 Replies)
Discussion started by: mpheine
2 Replies

9. Shell Programming and Scripting

ksh view std err state

I would like to know if a command works. "command" 2>/dev/null When I issue the command, the error is suppressed. How can I tell whether there was an error? (3 Replies)
Discussion started by: robin_simple
3 Replies

10. Shell Programming and Scripting

Keeping std & err outputs alive and feed one log file in a one-shot way

Bonjour, I have a large script with a lot of print statements and misc commands. Standard and error outputs are redirected like into the following code : #!/usr/bin/ksh LOG=/<some dir>/log > $LOG exec >>${LOG} 2>>${LOG} print aaaaa print bbbbb print ccccc ... some_cmd That way,... (5 Replies)
Discussion started by: Fundix
5 Replies
FBB::IOStream(3bobcat)					   std::istream and std::ostream				    FBB::IOStream(3bobcat)

NAME
FBB::IOStream - Combines std::istream and std::ostream features SYNOPSIS
#include <bobcat/iostream> Linking option: -lbobcat DESCRIPTION
This class combines the features of the std::istream and std::ostream classes. The std::istream and std::ostream may be physically differ- ent streams. FBB:IOStream objects may, e.g., be associated with streams wrapped around pipes (see, e.g., FBB::IfdStream and FBB::OFd- Stream), to construct bi-directional pipes. NAMESPACE
FBB All constructors, members, operators and manipulators, mentioned in this man-page, are defined in the namespace FBB. INHERITS FROM
FBB::IOStreambuf (private inheritance), std::istream, std::ostream CONSTRUCTORS
o IOStream(): The default constructor constructs an empty FBB::IOStream objects. It should not be used before its open member (see below) was called. o IOStream(std::istream &in, std::ostream &out): This constructor associates the IOStream object with a std::istream and a std::ostream. All output operations will be passed on to the std::ostream, all input operations to the std::istream. The streams passed to IOStream should outlive the IOStream object. This constructor performs the actions of the default constructor and then calls the IOStream::open member De copy constructor is avail- able as well. MEMBER FUNCTIONS
All members of std::istream and std::ostream are available, as FBB::IOStream inherits from these classes. Furthermore, when switching between std::istream and std::ostream operations, no intermediate seekg() or seekp() operation will normally be required, since the base classes will normally be associated with physically different streams. o void open(std::istream &in, std::ostream &out): This member (re)associates the IOStream object with a std::istream and a std::ostream. All output operations will be passed on to the std::ostream, all input operations to the std::istream. The streams passed to IOStream() should outlive the IOStream object. If this member is called for an IOStream object already associated with an std::ostream object, the already associated std::ostream object is flushed before setting up the new association. o void clear(): This member clears the error states of the associated std::istream and std::ostream objects. EXAMPLE
See the example provided with process(3bobcat). FILES
bobcat/iostream - defines the class interface SEE ALSO
bobcat(7), ifdstream(3bobcat), iostreambuf(3bobcat), ofdstream(3bobcat), process(3bobcat) BUGS
None Reported. DISTRIBUTION FILES
o bobcat_3.01.00-x.dsc: detached signature; o bobcat_3.01.00-x.tar.gz: source archive; o bobcat_3.01.00-x_i386.changes: change log; o libbobcat1_3.01.00-x_*.deb: debian package holding the libraries; o libbobcat1-dev_3.01.00-x_*.deb: debian package holding the libraries, headers and manual pages; o http://sourceforge.net/projects/bobcat: public archive location; BOBCAT
Bobcat is an acronym of `Brokken's Own Base Classes And Templates'. COPYRIGHT
This is free software, distributed under the terms of the GNU General Public License (GPL). AUTHOR
Frank B. Brokken (f.b.brokken@rug.nl). libbobcat1-dev_3.01.00-x.tar.gz 2005-2012 FBB::IOStream(3bobcat)
All times are GMT -4. The time now is 09:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy