The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to include RETURN KEY with Background process "&" in Shell Script racbern Shell Programming and Scripting 1 03-11-2008 03:30 AM
passing a list of dynamic names to a "PS" command in shell script? sachin.tendulka Shell Programming and Scripting 3 11-21-2007 12:18 AM
Unix shell script (grep -A 6 -B 2 "ORA-" filename el_guero Shell Programming and Scripting 7 04-25-2007 02:37 PM
Shell Script fails with "can't connect to client" sseenu79 HP-UX 2 12-20-2006 06:47 AM
"SCRIPT" (recording session) from ShellScripts mohanprabu Shell Programming and Scripting 3 11-27-2004 05:36 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-20-2006
Registered User
 

Join Date: Jul 2006
Posts: 2
Stumble this Post!
Question Q: Recording shell script screen output using "script" command ?

Hello,

I need to capture everything showed on a screen by a shell script which needs user interaction. The shell script performs commads such as rsh so normal redirection to a file does not work.

I know there is a special unix command call "script" which records screen session but the problem is that command creates his own sub-shell, avoiding launching a shell script which a "script" command built in.

For example, how followings lines in the same shell script get as result the ls command in filename.txt ?

#!/bin/ksh
script filename.txt
ls

Any idea or suggestion ???

Last edited by lalfonso.gomez; 07-20-2006 at 02:27 AM.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 07-20-2006
reborg's Avatar
Administrator
 
Join Date: Mar 2005
Location: Ireland
Posts: 3,513
Stumble this Post!
take the script command out of the shell script.

Thn run it as

script -c <shell script> filename.txt
Reply With Quote
  #3 (permalink)  
Old 07-20-2006
Registered User
 

Join Date: Jul 2006
Posts: 2
Stumble this Post!
Sorry, option not available on Solaris 10:

script -c "toRun" salida.txt
usage: script [ -a ] [ typescript ]
Reply With Quote
  #4 (permalink)  
Old 07-20-2006
reborg's Avatar
Administrator
 
Join Date: Mar 2005
Location: Ireland
Posts: 3,513
Stumble this Post!
Yes, why not just run script before the script?
Code:
$ script filename.tst
$ scriptname.sh
Reply With Quote
  #5 (permalink)  
Old 01-18-2007
Registered User
 

Join Date: Jan 2007
Posts: 1
Stumble this Post!
I have a similar need.

My users run an interactive bourne shell script, and the decisions they make need to be logged, and those logs need to be emailed.

Currently, the users need to remember to run the "script" command in advance of running the interactive script, then they need to email the output by hand afterward.

I would like to automate this for them so they do not forget to log it, and automatically send the email afterward, which would be possible if my interactive script got to specify the name of the log file.

Any ideas?
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:12 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0