[tz] [PROPOSED 03/18] Open /dev/null less often in tzselect

Paul Eggert eggert at cs.ucla.edu
Tue Dec 19 07:25:52 UTC 2023


* tzselect.ksh: Use >& so that the shell can dup2 rather than open.
---
 tzselect.ksh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tzselect.ksh b/tzselect.ksh
index 8f5f9b26..e85259b2 100644
--- a/tzselect.ksh
+++ b/tzselect.ksh
@@ -46,7 +46,7 @@ say() {
 }
 
 # Check for awk POSIX compliance.
-($AWK -v x=y 'BEGIN { exit 123 }') </dev/null >/dev/null 2>&1
+($AWK -v x=y 'BEGIN { exit 123 }') <>/dev/null >&0 2>&0
 [ $? = 123 ] || {
 	say >&2 "$0: Sorry, your '$AWK' program is not POSIX compatible."
 	exit 1
@@ -89,7 +89,7 @@ if
   ?*) : ;;
   '')
     # '; exit' should be redundant, but Dash doesn't properly fail without it.
-    (eval 'set --; select x; do break; done; exit') </dev/null 2>/dev/null
+    (eval 'set --; select x; do break; done; exit') <>/dev/null 2>&0
   esac
 then
   # Do this inside 'eval', as otherwise the shell might exit when parsing it
-- 
2.40.1




More information about the tz mailing list