Subject: bin/3276: script(1) makes bash emulate POSIX /bin/sh
To: None <gnats-bugs@gnats.netbsd.org>
From: None <era@iki.fi>
List: netbsd-bugs
Date: 03/02/1997 21:34:41
>Number: 3276
>Category: bin
>Synopsis: script(1) sets argv[0] of the started shell to "sh"
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Mar 2 14:35:01 1997
>Last-Modified:
>Originator: System Era
>Organization:
People Who Are Not Old Enough for Unix (Honorary Member Emeritus)
>Release: 1.2
>Environment:
bash-1.14.7(1) right out of the box;
1.2 #1 distribution pretty much without anything changed
(I've barely installed Emacs, Bash, Ssh, some Emacs libraries
... and (gasp) GNU Smalltalk)
$ what /usr/bin/script
/usr/bin/script
Copyright (c) 1980, 1992, 1993
System: NetBSD hello.netbsd.fi 1.2 NetBSD 1.2 (GENERIC) #1: Wed Sep 11 00:43:55 CDT 1996 scottr@spot:/usr/src/sys/arch/mac68k/compile/GENERIC mac68k
>Description:
script(1) starts my $SHELL allright but it sets argv[0] to "sh"
which Bash interprets as a request to emulate the POSIX shell
as closely as possible.
That means, among other things, that none of my aliases and
other neat stuff I normally use under Bash are not available.
Ideally, script(1) should not look like you're starting a
new session, but rather let a naive user believe you're still
executing the same shell as before you started script(1)
>How-To-Repeat:
neat bash prompt (time, date, hostname, bells, whistles) hello$ script
Script started, output file is typescript
bash$ # oops, this looks like /bin/sh more than Bash :-(
bash$ echo $0
sh
bash$ exit
Script done, output file is typescript
neat bash prompt (time, date, hostname, bells, whistles) hello$
>Fix:
No particular need for script(1) to set argv[0] to anything in
particular, is there?
Just do execv (shellname, shellname, options, (char *) NULL)
instead of execv (shellname, "sh", options, (char *) NULL)
>Audit-Trail:
>Unformatted: