The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages 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 07: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 04:18 AM
Unix shell script (grep -A 6 -B 2 "ORA-" filename el_guero Shell Programming and Scripting 7 04-25-2007 05:37 PM
Shell Script fails with "can't connect to client" sseenu79 HP-UX 2 12-20-2006 10:47 AM
"SCRIPT" (recording session) from ShellScripts mohanprabu Shell Programming and Scripting 3 11-27-2004 09:36 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-20-2006
lalfonso.gomez lalfonso.gomez is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 2
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 05:27 AM..
  #2 (permalink)  
Old 07-20-2006
reborg's Avatar
reborg reborg is offline Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,190
take the script command out of the shell script.

Thn run it as

script -c <shell script> filename.txt
  #3 (permalink)  
Old 07-20-2006
lalfonso.gomez lalfonso.gomez is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 2
Sorry, option not available on Solaris 10:

script -c "toRun" salida.txt
usage: script [ -a ] [ typescript ]
  #4 (permalink)  
Old 07-20-2006
reborg's Avatar
reborg reborg is offline Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,190
Yes, why not just run script before the script?
Code:
$ script filename.tst
$ scriptname.sh
  #5 (permalink)  
Old 01-18-2007
incircuitous incircuitous is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 1
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?
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 09:22 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0