Sponsored Content
Top Forums Shell Programming and Scripting Putting screen output in a log file Post 302143672 by matrixmadhan on Friday 2nd of November 2007 01:54:56 PM
Old 11-02-2007
the errors might have been meant for stderr rather than stdout

try this,

Code:
programname > logfile 2>&1

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Getting command output and putting into newfile

Hello All, I am using the below code: #!/bin/sh /omp/bin/TICLI "op:alarm,all" > filename for getting command output and then putting the output into newfile but the problem is this, that not the complete output goes into newfile and the script stops. for example: if this commands gives... (18 Replies)
Discussion started by: wakhan
18 Replies

2. UNIX Desktop Questions & Answers

Output terminal sessions to screen and log file

I would like to use a terminal session to ssh to switches and routers. I need to capture data while logged into switches to a file I can email for troubleshooting. I use termial to log into Cisco switch, run the sh tech command, and then sent the output to cisco. Is there a way to run a... (4 Replies)
Discussion started by: tdelliott
4 Replies

3. UNIX for Dummies Questions & Answers

how to print script output to screen and file

Hi all, I have a script that bulk loads thousands of lines of data. I need to log the output during the execution of the script. I know I can redirect (">") the output to a file; however, I want the output going to both the screen and the log file. I thought I could use pipe to pipe the... (10 Replies)
Discussion started by: orahi001
10 Replies

4. Shell Programming and Scripting

Complete Screen Output to Log File

Hi, I would need to log the whole screen ouput to a log file. All Inputs from the Agent, all echo´s and DBMS Outputs from the PL/SQL. Basicly everything what I can see during the run on the screen. I tried it already with #exec 2>$BASELOG/RUN.log #exec 1>$BASELOG/RUN.log #exec >... (1 Reply)
Discussion started by: enjoy
1 Replies

5. Shell Programming and Scripting

putting color on output file script

do you have any simple script on how to change the color and font of a string in a script example echo "====================================" echo " sample color script" echo "====================================" echo " hello " echo " bye" on hello,... (3 Replies)
Discussion started by: lhareigh890
3 Replies

6. Shell Programming and Scripting

Redirect the output in a file and on screen

I am trying to get following result from the scipt I have. First time it generates the o/p in correct format. However if I run it again it appends to the existing file. I would like to see o/p on screen as well as save it in file. Everytime it should create new file. ## I/P file 0174 0175... (3 Replies)
Discussion started by: dynamax
3 Replies

7. UNIX for Dummies Questions & Answers

Putting the Current -date in the Output File

Hi guys, Just want to ask how can I make a script that will perform like this. 1. Execute the command 2. Then the output of the command will be redirected to a file 2. The file that has been created will have a date on it equivalent to the date and time it was created (or maybe after the... (5 Replies)
Discussion started by: rymnd_12345
5 Replies

8. Shell Programming and Scripting

Need help putting output on one line

Good afternoon, I have been searching the web, and these forums for help. I will try my best to explain the issue, and what my desired results are. I am doing queries in MYSQL, and need the output to be sent to a file. That file needs to have things with the same ID on the same line. To... (14 Replies)
Discussion started by: brianjb
14 Replies

9. Programming

No output screen when run from file manager

So I have ported a C++ program from windows to linux and when I run it from terminal all is well. However when executed from file manager there is no screen output. The program runs and does what it should, just the problem of not knowing if there are errors or if its even complete. Is there a... (12 Replies)
Discussion started by: pinbot
12 Replies

10. UNIX for Beginners Questions & Answers

Screen output to a file

Hi All, I am trying to out of shell script when i run it like sh /mypath/abc.sh ....a screen log should be generated whenever i input the values, when above the script prompt for values Regards Amarendra (3 Replies)
Discussion started by: amar1208
3 Replies
SCRIPT(1)						    BSD General Commands Manual 						 SCRIPT(1)

NAME
script -- make typescript of terminal session SYNOPSIS
script [-a] [-k] [-q] [-t time] [file [command ...]] DESCRIPTION
The script utility makes a typescript of everything printed on your terminal. It is useful for students who need a hardcopy record of an interactive session as proof of an assignment, as the typescript file can be printed out later with lpr(1). If the argument file is given, script saves all dialogue in file. If no file name is given, the typescript is saved in the file typescript. If the argument command ... is given, script will run the specified command with an optional argument vector instead of an interactive shell. Options: -a Append the output to file or typescript, retaining the prior contents. -k Log keys sent to program as well as output. -q Run in quiet mode, omit the start and stop status messages. -t time Specify time interval between flushing script output file. A value of 0 causes script to flush for every character I/O event. The default interval is 30 seconds. The script ends when the forked shell (or command) exits (a control-D to exit the Bourne shell (sh(1)), and exit, logout or control-d (if ignoreeof is not set) for the C-shell, csh(1)). Certain interactive commands, such as vi(1), create garbage in the typescript file. The script utility works best with commands that do not manipulate the screen. The results are meant to emulate a hardcopy terminal, not an addressable one. ENVIRONMENT
The following environment variable is utilized by script: SHELL If the variable SHELL exists, the shell forked by script will be that shell. If SHELL is not set, the Bourne shell is assumed. (Most shells set this variable automatically). SEE ALSO
csh(1) (for the history mechanism). HISTORY
The script command appeared in 3.0BSD. BUGS
The script utility places everything in the log file, including linefeeds and backspaces. This is not what the naive user expects. It is not possible to specify a command without also naming the script file because of argument parsing compatibility issues. When running in -k mode, echo cancelling is far from ideal. The slave terminal mode is checked for ECHO mode to check when to avoid manual echo logging. This does not work when in a raw mode where the program being run is doing manual echo. BSD
June 6, 1993 BSD
All times are GMT -4. The time now is 09:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy