diff options
| author | David E. O'Brien <obrien@FreeBSD.org> | 2010-10-14 03:13:20 +0000 |
|---|---|---|
| committer | David E. O'Brien <obrien@FreeBSD.org> | 2010-10-14 03:13:20 +0000 |
| commit | cfd21e91da67c307e92e153356630a045c6f96b7 (patch) | |
| tree | 09eb7c79e6af068e6ceee9e84f2bcd6b8ccc0815 /usr.bin/script | |
| parent | 9681108efc22168640fcc7b2cd87a6e33aa7f822 (diff) | |
Notes
Diffstat (limited to 'usr.bin/script')
| -rw-r--r-- | usr.bin/script/script.1 | 15 | ||||
| -rw-r--r-- | usr.bin/script/script.c | 7 |
2 files changed, 21 insertions, 1 deletions
diff --git a/usr.bin/script/script.1 b/usr.bin/script/script.1 index 1c93b3e48a15..3e3fd72ea9a0 100644 --- a/usr.bin/script/script.1 +++ b/usr.bin/script/script.1 @@ -114,9 +114,22 @@ The utility works best with commands that do not manipulate the screen. The results are meant to emulate a hardcopy terminal, not an addressable one. .Sh ENVIRONMENT -The following environment variable is utilized by +The following environment variables are utilized by .Nm : .Bl -tag -width SHELL +.It Ev SCRIPT +The +.Ev SCRIPT +environment variable is added to the sub-shell. +If +.Ev SCRIPT +already existed in the users environment, +its value is overwritten within the sub-shell. +The value of +.Ev SCRIPT +is the name of the +.Ar typescript +file. .It Ev SHELL If the variable .Ev SHELL diff --git a/usr.bin/script/script.c b/usr.bin/script/script.c index ad706dcdd350..b10b7e659cee 100644 --- a/usr.bin/script/script.c +++ b/usr.bin/script/script.c @@ -241,14 +241,21 @@ void doshell(char **av) { const char *shell; + int k; shell = getenv("SHELL"); if (shell == NULL) shell = _PATH_BSHELL; + if (av[0]) + for (k = 0 ; av[k] ; ++k) + fprintf(fscript, "%s%s", k ? " " : "", av[k]); + fprintf(fscript, "\r\n"); + (void)close(master); (void)fclose(fscript); login_tty(slave); + setenv("SCRIPT", fname, 1); if (av[0]) { execvp(av[0], av); warn("%s", av[0]); |
