Sponsored Content
Top Forums Shell Programming and Scripting How to get return value from C program and logs to file Post 302172973 by sjday on Wednesday 5th of March 2008 08:23:03 AM
Old 03-05-2008
try this

you need to look at the system variable $PIPESTATUS

echo "Running program output"
myLine="./add 1 11"
`expr "$myLine"`| tee outputfile
echo "Succ/Fail : $PIPESTATUS"
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 's

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

Grep yesterday logs from weblogic logs

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

How to capture C program return values in Kshell

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

Trapping program return code

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

Parallel Processing Detection and Program Return Value Detection

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

Program: How to FTP logs from a Server to Desktop

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

How to end the program with a successful return code?

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

File command return wrong filetype while file holds group separator char.

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

Segment fault for C++ program when return vector

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

If I ran perl script again,old logs should move with today date and new logs should generate.

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
tee(1)							      General Commands Manual							    tee(1)

NAME
tee - Displays the output of a program and copies it into a file SYNOPSIS
tee [-ai] file... STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: tee: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
Adds the output to the end of file instead of writing over it. Ignores the SIGINT signal. OPERANDS
Standard input is stored into, or appended to, the file specified. [Tru64 UNIX] The tee command can accept up to 20 file arguments. DESCRIPTION
The tee command reads standard input and writes to both standard output, and each specified file. The tee command is useful when you wish to view program output as it is displayed, and also want to save it in a file. The tee command does not buffer output, so you may wish to pipe the output of tee to more if more than one full screen of data is anticipated. NOTES
If a write to any file fails, the exit status of tee will be non-zero. Writes to all other specified files may be successful, and opera- tion will continue until standard input is exhausted. EXIT STATUS
The following exit values are returned: Successful completion. An error occurred. EXAMPLES
To view and save the output from a command at the same time, enter: lint program.c | tee program.lint This displays the standard output of the command lint program.c at the terminal, and at the same time saves a copy of it in the file program.lint. If program.lint already exists, it is deleted and replaced. To display and append to a file, enter: lint program.c | tee -a program.lint This displays the standard output of lint program.c at the terminal and at the same time appends a copy of it to the end of pro- gram.lint. If the file program.lint does not exist, it is created. ENVIRONMENT VARIABLES
The following environment variables affect the execution of tee: Provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari- ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the locale for the for- mat and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MESSAGES. SEE ALSO
Commands: cat(1), echo(1), script(1) Standards: standards(5) tee(1)
All times are GMT -4. The time now is 01:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy