Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using the script command

Status
Not open for further replies.

jouell

MIS
Nov 19, 2002
304
US
How can I use the script command to capture command in a script?


If I create a script called test.sh:

#cat test.sh

script test.txt
ls
exit


It waits until I type exit and then does the ls and then exits. I'd like to be able to capture the whole command line (not just the output ) I am running.

Ideas?
-John



 
one 'hacky' way is:

$ script.sh

script.sh:
Code:
#!/bin/ksh

oldSHELL="${SHELL}"
export SHELL='/tmp/myScript.sh'
script /tmp/script.out
export SHELL="${oldSHELL}"

myScript.sh (for example):
Code:
#!/bin/ksh
ls /tmp
ps -ef

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top