[tz] [PATCH 3/3] tzselect: use /bin/sh by default

Paul Eggert eggert at cs.ucla.edu
Sat Oct 27 20:56:36 UTC 2012


On 10/27/2012 12:35 PM, Mike Frysinger wrote:
> i can live with bash

OK, how about this?

>From 6daf83cd406f0c5453d53a65d663e20668491381 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert at cs.ucla.edu>
Date: Sat, 27 Oct 2012 13:54:13 -0700
Subject: [PATCH] Have tzselect.ksh use Bash by default; this can be
 overridden.

* Makefile (KSHELL): New macro.
(tzselect): Use it.
* tzselect.ksh: Use "#!/bin/bash", not "#! /bin/ksh".  The Makefile
can override this.  No need for a space after "!'; that was put in
years ago only because of an urban legend.
---
 Makefile     |    5 +++++
 tzselect.ksh |   31 ++++++++++++-------------------
 2 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/Makefile b/Makefile
index 8b539c1..c8150ba 100644
--- a/Makefile
+++ b/Makefile
@@ -238,6 +238,10 @@ ZIC=		$(zic) $(ZFLAGS)
 # The name of a Posix-compliant `awk' on your system.
 AWK=		awk
 
+# The full path name of a Posix-compliant shell that supports the Korn shell's
+# 'select' statement, as an extension.  These days, Bash is the most popular.
+KSHELL=		/bin/bash
+
 # The path where SGML DTDs are kept.
 # The default is appropriate for Ubuntu.
 SGML_TOPDIR= /usr
@@ -389,6 +393,7 @@ date:		$(DATEOBJS)
 
 tzselect:	tzselect.ksh
 		sed \
+			-e 's|#!/bin/bash|#!$(KSHELL)|g' \
 			-e 's|AWK=[^}]*|AWK=$(AWK)|g' \
 			-e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \
 			-e 's|\(TZVERSION\)=.*|\1=tz$(VERSION)|' \
diff --git a/tzselect.ksh b/tzselect.ksh
index 9e8ceea..4fe5d02 100644
--- a/tzselect.ksh
+++ b/tzselect.ksh
@@ -1,4 +1,4 @@
-#! /bin/ksh
+#!/bin/bash
 
 TZVERSION=see_Makefile
 
@@ -9,29 +9,22 @@ TZVERSION=see_Makefile
 
 # Porting notes:
 #
-# This script requires several features of the Korn shell.
-# If your host lacks the Korn shell,
-# you can use either of the following free programs instead:
-#
-#	<a href=ftp://ftp.gnu.org/pub/gnu/>
-#	Bourne-Again shell (bash)
-#	</a>
+# This script requires a Posix-like shell with the extension of a
+# 'select' statement.  The 'select' statement was introduced in the
+# Korn shell and is available in Bash and other shell implementations.
+# If your host lacks both Bash and the Korn shell, you can get their
+# source from one of these locations:
 #
-#	<a href=ftp://ftp.cs.mun.ca/pub/pdksh/pdksh.tar.gz>
-#	Public domain ksh
-#	</a>
+#	Bash <http://www.gnu.org/software/bash/bash.html>
+#	Korn Shell <http://www.kornshell.com/>
+#	Public Domain Korn Shell <http://www.cs.mun.ca/~michael/pdksh/>
 #
 # This script also uses several features of modern awk programs.
-# If your host lacks awk, or has an old awk that does not conform to Posix.2,
+# If your host lacks awk, or has an old awk that does not conform to Posix,
 # you can use either of the following free programs instead:
 #
-#	<a href=ftp://ftp.gnu.org/pub/gnu/>
-#	GNU awk (gawk)
-#	</a>
-#
-#	<a href=ftp://ftp.whidbey.net/pub/brennan/>
-#	mawk
-#	</a>
+#	Gawk (GNU awk) <http://www.gnu.org/software/gawk/>
+#	mawk <http://invisible-island.net/mawk/>
 
 
 # Specify default values for environment variables if they are unset.
-- 
1.7.9.5





More information about the tz mailing list