11-22-2017
Alternatively use script. This starts a sub-shell in your current terminal and saves all output to a file. After you have finished exit the sub-shell and the file is closed for review.
Andrew
This User Gave Thanks to apmcd47 For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi!
I want to write a script that will create an archive (via tar) that will restrict the size of the tar file. The size can be constrained using the keyword 'k' and providing the size restriction. The problem is that the script needs to know (detect) when the tar command prompts the user (which... (2 Replies)
Discussion started by: mitch8
2 Replies
2. Shell Programming and Scripting
hi, new to to forum...
i've been trying to create a script in tcsh but i'm having a problem with one thing...
the script has to keep log of it's input and output so i'm using
tee -a log | script | tee -a log
this keeps the logs as asked, but it gives me an extra empty prompt (not in the... (0 Replies)
Discussion started by: moseschrist
0 Replies
3. Shell Programming and Scripting
ok,
i am aware of adding the directory where the files are located into the .profile file but the problem is, its not working for me.
can someone please spell out how to properly edit these configuration files so i can run a command anywhere on the system without having to be in the... (2 Replies)
Discussion started by: Terrible
2 Replies
4. Solaris
I create a succesful pkgask 'response' file:
pkgask -r xyz.pkg
I then attempt to use the 'response' file with pkgadd:
pkgadd -nr /home/user/response -d /home/user/xyz.pkg
the prompts for user input still appear. I have also tried an 'admin' file but that still prompts for user input as... (1 Reply)
Discussion started by: prkfriryce
1 Replies
5. Shell Programming and Scripting
script1:
#!/bin/ksh
more test.txt
script2: calling the script1
#!/bin/ksh
/tmp/script1.sh 2>&1 | tee tee.log
where test.txt contains ~1200 lines.
When I execute the script2 the more command does not print pagewise it goes to the end of the line, when I remove the tee command it... (4 Replies)
Discussion started by: prasad111
4 Replies
6. Shell Programming and Scripting
Hi guys.
I m creating scripts which input multiple value , inside sqlplus script when it prompt/accept
do anybody know how to provide multiple value inside sqlplus script when it prompt.
like,
enter value for first:
enter value for second:
enter value "save file as " :
I m try... (11 Replies)
Discussion started by: tapia
11 Replies
7. UNIX for Advanced & Expert Users
Hi,
Want to log the output of command & check the exit status to find whether it succeeded or failed.
> ls abc
ls: abc: No such file or directory
> echo $?
1
> ls abc 2>&1 | tee log
ls: abc: No such file or directory
> echo $?
0
Tee commands changes my exit status to be always... (7 Replies)
Discussion started by: vibhor_agarwali
7 Replies
8. Shell Programming and Scripting
Hi, I'm writing a script,
in the script I need to use tcpdump to capture some packets
however it needs root priviledge
my computer is configured by school and I have no real root priviledge
so I can't use sudo on my computer,like
Code:
sudo tcpdump ......
I have to use a limited... (1 Reply)
Discussion started by: esolve
1 Replies
9. Shell Programming and Scripting
In the current directory , I have seven files .
But when I use the following command , it lists eight files ( 7 files + file_list.xtx)
ls -1 | tee file_list.xtx | while read line; do echo $line ; done
Does the tee command create the file_list.xtx file first and then executes the ls -1... (1 Reply)
Discussion started by: kumarjt
1 Replies
10. Shell Programming and Scripting
Hi All,
I am a novice to UNIX, i need to know is there a way to provide 2 inputs when the shell prompts and i need to assign those 2 values to 2 separate variables. I dont want to give those values as a arguments (while running the script).
Thanks in advance!! (1 Reply)
Discussion started by: prasanna2166
1 Replies
SCRIPT(1) BSD General Commands Manual SCRIPT(1)
NAME
script -- make typescript of terminal session
SYNOPSIS
script [-akq] [-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.
The following options are available:
-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
January 22, 2004 BSD