check shell correctly

This commit is contained in:
Than Ngo 2021-12-02 15:53:11 +01:00
parent 1784ef6a01
commit 0811db734b
2 changed files with 11 additions and 4 deletions

View File

@ -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 <than@redhat.com> - 2.21-31
- check shell correctly
* Tue Oct 26 2021 Than Ngo <than@redhat.com> - 2.21-30
- disable the --read-functions option in korn shells

View File

@ -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 () {