03-14-2008
Output from executable
Want to print output from the exe to file and terminal at a time.
So, used `tee` command. But return status of tee is printed instead of
exe return value.
Can use pipestatus. pipestatus is printing value but need to run like "bash script.sh". I need to run the script using "sh".
Help needed.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi All,
Can anyone please let me know the syntax / how to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 'system()' function and '${?}'.
I am in a process to send the mail automatically with an attachment to bulk users. I have used 'Mailx' and 'Unencode'... (0 Replies)
Discussion started by: manas6
0 Replies
2. Shell Programming and Scripting
Hi,
I am trying to write a script which would go search and get the info from the logs based on yesterday timestamp and write yesterday logs in new file. The log file format is as follows:
""""""""""""""""""""""""""... (3 Replies)
Discussion started by: harish.parker
3 Replies
3. Shell Programming and Scripting
I have a K shell script (ksh) that needs to return an email address. A C program was written (prog1) to now access the email address off of an oracle table. The call to the program in the ksh is
prog1 -p parm1
Based on Parm1 the program will read an oracle table and retrieve the email... (2 Replies)
Discussion started by: jclanc8
2 Replies
4. Shell Programming and Scripting
Hello
I have a program (prog) that accepts a parameter in order to execute some internal loop grabbing memory in each iteration. I'm using top to monitor the memory usage and to produce an output.
Thus I need the program's pid as a parameter to top.
I capture pid using myPID=$!.
I'm also... (5 Replies)
Discussion started by: pavlosgr
5 Replies
5. Programming
Hey, for the purpose of a research project I need to know if a specific type of parallel processing is being utilized by any user-run programs. Is there a way to detect whether a program either returns a value to another program at the end of execution, or just utilizes any form of parallel... (4 Replies)
Discussion started by: azar.zorn
4 Replies
6. UNIX for Dummies Questions & Answers
Hi guys,
Good day! Anyone there could suggest on how can I create a program that will get (ftp) the logs I need from a remote Server (running in Linux) into my Desktop (running in Windows 7). For Perl program suggestions, FYI that I'm using Active Perl version. The reason why I need this one is... (2 Replies)
Discussion started by: rymnd_12345
2 Replies
7. Shell Programming and Scripting
i have the follow shell script that try to find any file in the specified path and upload to oracle.
if no file will output in the concurrent log and the program return as error , how do i change the program so that if no file found will give out normal sucessful result.
i tried change the exit... (3 Replies)
Discussion started by: feilhk
3 Replies
8. UNIX for Advanced & Expert Users
hi,
I am trying to get the FileType using the File command. I have one file, which holds Group separator along with ASCII character.
It's a Text file.
But when I ran the File command the FileType is coming as "data".
It should be "ASCII, Text file".
Is the latest version of File... (6 Replies)
Discussion started by: Arpitak29
6 Replies
9. Programming
I am trying to reverse complement DNA sequence (string) with a short c++ code using boost library. Code was compiled without any warning/error, but ran into Segmentation fault.
My guess is the function to return a vector, but not sure.
#include <iostream>
#include <fstream>
#include <string>... (14 Replies)
Discussion started by: yifangt
14 Replies
10. Shell Programming and Scripting
Appreciate help for the below issue.
Im using below code.....I dont want to attach the logs when I ran the perl twice...I just want to take backup with today date and generate new logs...What I need to do for the below scirpt..............
1)if logs exist it should move the logs with extention... (1 Reply)
Discussion started by: Sanjeev G
1 Replies
LEARN ABOUT DEBIAN
io::tee
Tee(3pm) User Contributed Perl Documentation Tee(3pm)
NAME
IO::Tee - Multiplex output to multiple output handles
SYNOPSIS
use IO::Tee;
$tee = IO::Tee->new($handle1, $handle2);
print $tee "foo", "bar";
my $input = <$tee>;
DESCRIPTION
"IO::Tee" objects can be used to multiplex input and output in two different ways. The first way is to multiplex output to zero or more
output handles. The "IO::Tee" constructor, given a list of output handles, returns a tied handle that can be written to. When written to
(using print or printf), the "IO::Tee" object multiplexes the output to the list of handles originally passed to the constructor. As a
shortcut, you can also directly pass a string or an array reference to the constructor, in which case "IO::File::new" is called for you
with the specified argument or arguments.
The second way is to multiplex input from one input handle to zero or more output handles as it is being read. The "IO::Tee" constructor,
given an input handle followed by a list of output handles, returns a tied handle that can be read from as well as written to. When
written to, the "IO::Tee" object multiplexes the output to all handles passed to the constructor, as described in the previous paragraph.
When read from, the "IO::Tee" object reads from the input handle given as the first argument to the "IO::Tee" constructor, then writes any
data read to the output handles given as the remaining arguments to the constructor.
The "IO::Tee" class supports certain "IO::Handle" and "IO::File" methods related to input and output. In particular, the following methods
will iterate themselves over all handles associated with the "IO::Tee" object, and return TRUE indicating success if and only if all
associated handles returned TRUE indicating success:
close
truncate
write
syswrite
format_write
formline
fcntl
ioctl
flush
clearerr
seek
The following methods perform input multiplexing as described above:
read
sysread
readline
getc
gets
eof
getline
getlines
The following methods can be used to set (but not retrieve) the current values of output-related state variables on all associated handles:
autoflush
output_field_separator
output_record_separator
format_page_number
format_lines_per_page
format_lines_left
format_name
format_top_name
format_line_break_characters
format_formfeed
The following methods are directly passed on to the input handle given as the first argument to the "IO::Tee" constructor:
input_record_separator
input_line_number
Note that the return value of input multiplexing methods (such as "print") is always the return value of the input action, not the return
value of subsequent output actions. In particular, no error is indicated by the return value if the input action itself succeeds but
subsequent output multiplexing fails.
EXAMPLE
use IO::Tee;
use IO::File;
my $tee = new IO::Tee(*STDOUT,
new IO::File(">tt1.out"), ">tt2.out");
print join(' ', $tee->handles), "
";
for (1..10) { print $tee $_, "
" }
for (1..10) { $tee->print($_, "
") }
$tee->flush;
$tee = new IO::Tee('</etc/passwd', *STDOUT);
my @lines = <$tee>;
print scalar(@lines);
AUTHOR
Chung-chieh Shan, ken@digitas.harvard.edu
COPYRIGHT
Copyright (c) 1998-2001 Chung-chieh Shan. All rights reserved. This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
SEE ALSO
perlfunc, IO::Handle, IO::File.
perl v5.12.3 2001-03-10 Tee(3pm)