The script utility works like this:
$ script
Script started, file is typescript
$ ls
2 bin doubleline new1 play typescript
alok core filelist output pslist unix
$ ps
PID TTY TIME CMD
28149 pts/7 0:00 ksh.ms
$
Script done, file is typescript
After this contents of the typescript file are:
$ cat typescript
Script started on Wed Sep 07 05:56:26 2011
$ ls
2 bin doubleline new1 play typescript
alok core filelist output pslist unix
$ ps
PID TTY TIME CMD
28149 pts/7 0:00 ksh.ms
$
script done on Wed Sep 07 05:56:33 2011
$
I want to copy this behaviour with using other commands and I/O redirections.
The solution must be a one line command (may include pipelined commands).
Any help would be great, like if anyone can tell how can we redirect stdin, stdout and stderr to some file while all the data is still on the terminal.
1 Answer