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


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Q: Recording shell script screen output using "script" command ?
# 1  
Old 07-20-2006
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 06:27 AM..
# 2  
Old 07-20-2006
take the script command out of the shell script.

Thn run it as

script -c <shell script> filename.txt
# 3  
Old 07-20-2006
Sorry, option not available on Solaris 10:

script -c "toRun" salida.txt
usage: script [ -a ] [ typescript ]
# 4  
Old 07-20-2006
Yes, why not just run script before the script?
Code:
$ script filename.tst
$ scriptname.sh

# 5  
Old 01-18-2007
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?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

2. Homework & Coursework Questions

Need help creating shell script with output that has 2014 calendar and 2 text items from a"fortune"

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: I am required to create a bash shell script with either emacs or vi. It must include the year 2014 calendar on... (9 Replies)
Discussion started by: dandanhelpmeman
9 Replies

3. Shell Programming and Scripting

Screen output is blocked by "| tee" command

BACK STORY: I have a script build.py . (It's for creating the ISO file for a special edition of Swift Linux.) This build.py script executes the mintConstructor.py script that I use to modify the Regular Swift Linux ISO to get the special edition Swift Linux ISO. The lines of the script that... (2 Replies)
Discussion started by: swiftlinux
2 Replies

4. Emergency UNIX and Linux Support

Urgent Help on "Script Command" on a shell script

Dear All, I am trying to capture the terminal session using the script command. It works when i issue on that has a command. But it is not working on inside a shell script as it is expecting a exit command to come out. Even after I ran the script and it expects me type the exit command and not... (14 Replies)
Discussion started by: rrb2009
14 Replies

5. UNIX for Dummies Questions & Answers

Explanation of "total" field in "ls -l" command output

When I do a listing in one particular directory (ls -al) I get: total 43456 drwxrwxrwx 2 root root 4096 drwxrwxrwx 3 root root 4096 -rwxrwxr-x 1 nobody nobody 3701594 -rwxrwxr-x 1 nobody nobody 3108510 -rwxrwxr-x 1 nobody nobody 3070580 -rwxrwxr-x 1 nobody nobody 3099733 -rwxrwxr-x 1... (1 Reply)
Discussion started by: proactiveaditya
1 Replies

6. Shell Programming and Scripting

"sed" command is not working in shell script

Hi All, I am not much strong in shell scripting... I am using sed command in my script to find and replace a string....... This is how script looks : ############# #!/usr/bin/ksh CONFIG_FILE=iom_test.txt FIND=`echo "NIS_FTP_SERVER1=123.456.iom.com"` REPLACE=`echo... (2 Replies)
Discussion started by: askumarece
2 Replies

7. AIX

"too big" and "not enough memory" errors in shell script

Hi, This is odd, however here goes. There are several shell scripts that run in our production environment AIX 595 LPAR m/c, which has sufficient memory 14GB (physical memory) and horsepower 5CPUs. However from time to time we get the following errors in these shell scripts. The time when these... (11 Replies)
Discussion started by: jerardfjay
11 Replies

8. Shell Programming and Scripting

To record screen output using "script" command

I am trying to capture the session of a particular user id, by using the "script" command, by adding the "script" command to the .profile of that user id. Now, when I have to exit the session, I am having to give 2 exits - one for the script command, and the other to log out of the session. Is... (2 Replies)
Discussion started by: ggayathri
2 Replies

9. Shell Programming and Scripting

passing a list of dynamic names to a "PS" command in shell script?

Hi, I am new to shell script. This is my first post .I have written a small script which returns list of names starts with "ram" in /etc/passwd .Here is that:- #!/bin/ksh NAME_LIST="name_list.txt" cat /dev/null > $NAME_LIST evalcmd="cat /etc/passwd | grep "^ram?*" | cut -d: -f1" eval... (3 Replies)
Discussion started by: sachin.tendulka
3 Replies

10. Shell Programming and Scripting

"SCRIPT" (recording session) from ShellScripts

Hi all, Hope that we are all familiar with the "script" command, which helps us to record the session into any file, until we give "exit". Can anyone help me, how to do this process from a shell script!? I face problem while ending the script using "exit" which comes out of the program. This... (3 Replies)
Discussion started by: mohanprabu
3 Replies
Login or Register to Ask a Question