diff --git a/which.spec b/which.spec index 474b530..e37062f 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: 30%{?dist} +Release: 31%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -41,6 +41,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Thu Dec 02 2021 Than Ngo - 2.21-31 +- check shell correctly + * Tue Oct 26 2021 Than Ngo - 2.21-30 - disable the --read-functions option in korn shells diff --git a/which2.sh b/which2.sh index ae2a254..0f47f9e 100644 --- a/which2.sh +++ b/which2.sh @@ -1,8 +1,8 @@ # shellcheck shell=sh # Initialization script for bash, sh, mksh and ksh -case "$(cat /proc/$$/comm)" in -ksh|mksh) +case "$(basename $(readlink /proc/$$/exe))" in +*ksh*) which_declare="" which_opt="" ;; @@ -10,10 +10,14 @@ zsh) which_declare="typeset -f" which_opt="" ;; -*) +bash|sh) which_declare="declare -f" which_opt="-f" ;; +*) + which_declare="" + which_opt="" + ;; esac which () {