Unix/Linux Go Back    


Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Q: Recording shell script screen output using "script" command ?

Shell Programming and Scripting


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 07-20-2006
lalfonso.gomez lalfonso.gomez is offline
Registered User
 
Join Date: Jul 2006
Last Activity: 20 July 2006, 8:05 AM EDT
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Unix or Linux 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..
Sponsored Links
    #2  
Old Unix and Linux 07-20-2006
reborg's Unix or Linux Image
reborg reborg is offline Forum Advisor  
Administrator Emeritus
 
Join Date: Mar 2005
Last Activity: 29 March 2012, 7:00 PM EDT
Location: Ireland
Posts: 4,464
Thanks: 0
Thanked 13 Times in 11 Posts
take the script command out of the shell script.

Thn run it as

script -c <shell script> filename.txt
Sponsored Links
    #3  
Old Unix and Linux 07-20-2006
lalfonso.gomez lalfonso.gomez is offline
Registered User
 
Join Date: Jul 2006
Last Activity: 20 July 2006, 8:05 AM EDT
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Sorry, option not available on Solaris 10:

script -c "toRun" salida.txt
usage: script [ -a ] [ typescript ]
    #4  
Old Unix and Linux 07-20-2006
reborg's Unix or Linux Image
reborg reborg is offline Forum Advisor  
Administrator Emeritus
 
Join Date: Mar 2005
Last Activity: 29 March 2012, 7:00 PM EDT
Location: Ireland
Posts: 4,464
Thanks: 0
Thanked 13 Times in 11 Posts
Yes, why not just run script before the script?

Code:
$ script filename.tst
$ scriptname.sh

Sponsored Links
    #5  
Old Unix and Linux 01-18-2007
incircuitous incircuitous is offline
Registered User
 
Join Date: Jan 2007
Last Activity: 21 March 2007, 1:55 PM EDT
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
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 Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Screen output is blocked by "| tee" command swiftlinux Shell Programming and Scripting 2 03-26-2012 09:44 PM
Urgent Help on "Script Command" on a shell script rrb2009 Emergency UNIX and Linux Support 14 10-11-2010 10:38 AM
To record screen output using "script" command ggayathri Shell Programming and Scripting 2 03-01-2009 02:54 PM
passing a list of dynamic names to a "PS" command in shell script? sachin.tendulka Shell Programming and Scripting 3 11-21-2007 03:18 AM
"SCRIPT" (recording session) from ShellScripts mohanprabu Shell Programming and Scripting 3 11-27-2004 08:36 AM



All times are GMT -4. The time now is 07:45 PM.