From 9542d05e680325f7d0ffddced31bd7923244c310 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Tue, 23 Mar 2021 20:15:21 +0100 Subject: [PATCH] fixed regression if SHELL=zsh --- which.spec | 5 ++++- which2.sh | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/which.spec b/which.spec index a3bf2c3..fac26a9 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 23%{?dist} +Release: 24%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -40,6 +40,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Tue Mar 23 2021 Than Ngo - 2.21-24 +- fixed regression if SHELL=zsh + * Sun Mar 21 2021 Than Ngo - 2.21-23 - fixed coverity issues - improved which2.sh diff --git a/which2.sh b/which2.sh index 9b5e0b0..2b8b20a 100644 --- a/which2.sh +++ b/which2.sh @@ -1,9 +1,11 @@ +# shellcheck shell=sh # Initialization script for bash, sh, mksh and ksh _declare="declare -f" _opt="-f" +_shell="$(basename $SHELL)" -if [ "$0" = "ksh" ] || [ "$0" = "-ksh" ] || [ "$0" = "mksh" ] || [ "$0" = "-mksh" ] ; then +if [ "$_shell" = "ksh" ] || [ "$_shell" = "mksh" ] || [ "$_shell" = "zsh" ] ; then _declare="typeset -f" _opt="" fi