Sponsored Content
Top Forums Shell Programming and Scripting Capture Shell Script Output To A File Post 302276279 by Corona688 on Tuesday 13th of January 2009 11:37:30 AM
Old 01-13-2009
You cannot do both with just a redirection, because one file descriptor cannot output to more than one stream; it becomes a lot trickier, needing an entire second process to write the extra stream, either that or significant modifications to your original script.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Capture output from interactive script

I have written a menu driven script to walk users through bringing up and down an application process. Sometimes the user tells me the script does not work taking the application down, but he can't recall seeing an error message. Is there a way to capture std out and stderr out from an... (6 Replies)
Discussion started by: MizzGail
6 Replies

2. UNIX for Advanced & Expert Users

Capture output to file and printer

Hi All : I wanted a unix command by which I could be able to print the output to a file and at the same time to a printer. Any help will be greatly appreciated. Regards, Ramamurthy Dasari (1 Reply)
Discussion started by: rdasari
1 Replies

3. UNIX for Dummies Questions & Answers

capture shell output in cron entry

Hey all, I'm running scripts from cron and I want to capture the output from the 1 file handle. Ex. * * * * * /test.sh 1>test.log. I also want to append a formatted date to the file. * * * * /test.sh 1>test.log_date +%m%d%y but I keep keep getting the output as if I had just added the date... (5 Replies)
Discussion started by: steve72
5 Replies

4. Shell Programming and Scripting

script to capture certain output

Hi All, I want to create a script that capture only Date & Time, Current CPU % usage, Disk % usage, Mem % usage and Top process based on this output; Data Collected: 05/17/08 17:19:49 Refresh Interval: 600 seconds GlancePlus Started/Reset: 05/17/08 08:19:45 B3692A GlancePlus... (18 Replies)
Discussion started by: fara_aris
18 Replies

5. Shell Programming and Scripting

capture output of file and send last string thereof to new file

Hello, If I run a program from within shell, the output is displayed in the command line terminal. Is there a way I can capture that output and choose only the very last string in it to send it to a new file? Thank you (6 Replies)
Discussion started by: Lorna
6 Replies

6. Shell Programming and Scripting

Script to capture snoop output

Hi Everyone :), Need your advice as I'm new to UNIX scripting.. I'm trying to write a script to capture snoop output for 5 minutes for every hour for 24 hours. To stop snoop, I need to press Control-C to break it. This is what I got so far, but now I'm stuck! :confused: The script: # cat... (2 Replies)
Discussion started by: faraaris
2 Replies

7. Shell Programming and Scripting

How to capture output to log file

Hi I have a script that will run multiple unix & sql commands. I want to see the output as well as capture it to a log file for further analysis. Is there an easy way to do that instead of adding "tee -a logfile" on everyline or even on the execute line (i.e. script | tee -s logfile). Thanks (1 Reply)
Discussion started by: nimo
1 Replies

8. Shell Programming and Scripting

Want ro capture the debug in output file

I want to capture the debug for the below command in output file . i tried like this but its not working: sh -xv <scriptname> >> output.log i want the output in a log file. Anyone plz help in this (2 Replies)
Discussion started by: chakkaravarthy
2 Replies

9. Shell Programming and Scripting

Capture output from expect script

Hi I am new to Expect scripting. I have to connect to a remote server and capture the output. Here I need output of " send "list registered\r"" to be stored in a file. but after execution, /tmp/capture.txt is of 0 byte #!/usr/bin/expect spawn ssh abc@10.10.10.10 -p 5022 expect... (2 Replies)
Discussion started by: bns928
2 Replies

10. Homework & Coursework Questions

How to Dynamically Pass Parameter to plsql Function & Capture its Output Value in a Shell Variable?

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: 2. Relevant commands, code, scripts, algorithms: #! /bin/ksh v="ORG_ID" ... (2 Replies)
Discussion started by: sujitdas2104
2 Replies
fclose(3C)						   Standard C Library Functions 						fclose(3C)

NAME
fclose - close a stream SYNOPSIS
#include <stdio.h> int fclose(FILE *stream); DESCRIPTION
The fclose() function causes the stream pointed to by stream to be flushed and the associated file to be closed. Any unwritten buffered data for the stream is written to the file; any unread buffered data is discarded. The stream is disassociated from the file. If the asso- ciated buffer was automatically allocated, it is deallocated. The fclose() function marks for update the st_ctime and st_mtime fields of the underlying file if the stream is writable and if buffered data has not yet been written to the file. It will perform a close(2) operation on the file descriptor that is associated with the stream pointed to by stream. After the call to fclose(), any use of stream causes undefined behavior. The fclose() function is performed automatically for all open files upon calling exit(2). RETURN VALUES
Upon successful completion, fclose() returns 0. Otherwise, it returns EOF and sets errno to indicate the error. ERRORS
The fclose() function will fail if: EAGAIN The O_NONBLOCK flag is set for the file descriptor underlying stream and the process would be delayed in the write opera- tion. EBADF The file descriptor underlying stream is not valid. EFBIG An attempt was made to write a file that exceeds the maximum file size or the process's file size limit; or the file is a regular file and an attempt was made to write at or beyond the offset maximum associated with the corresponding stream. EINTR The fclose() function was interrupted by a signal. EIO The process is a member of a background process group attempting to write to its controlling terminal, TOSTOP is set, the process is neither ignoring nor blocking SIGTTOU and the process group of the process is orphaned. ENOSPC There was no free space remaining on the device containing the file. EPIPE An attempt is made to write to a pipe or FIFO that is not open for reading by any process. A SIGPIPE signal will also be sent to the calling thread. The fclose() function may fail if: ENXIO A request was made of a non-existent device, or the request was beyond the limits of the device. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
close(2), exit(2), getrlimit(2), ulimit(2), fopen(3C), stdio(3C), attributes(5), standards(5) SunOS 5.10 1 Nov 2003 fclose(3C)
All times are GMT -4. The time now is 02:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy