NetBSD Problem Report #3276
Received: (qmail-queue invoked from smtpd); 2 Mar 1997 22:20:22 -0000
Message-Id: <199703021934.VAA20717@hello.netbsd.fi>
Date: Sun, 2 Mar 1997 21:34:41 +0200 (EET)
From: era@iki.fi
Reply-To: era@iki.fi
To: gnats-bugs@gnats.netbsd.org
Subject: script(1) makes bash emulate POSIX /bin/sh
X-Send-Pr-Version: 3.95
>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
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Mar 02 14:35:01 +0000 1997
>Closed-Date: Sun Mar 02 20:02:27 +0000 1997
>Last-Modified: Mon Mar 03 04:02:34 +0000 1997
>Originator: System Era
>Release: 1.2
>Organization:
People Who Are Not Old Enough for Unix (Honorary Member Emeritus)
>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)
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: mikel
State-Changed-When: Sun Mar 2 20:02:27 1997
State-Changed-Why:
fixed, thanks.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.