improved which2.sh
This commit is contained in:
parent
9542d05e68
commit
98662a9c46
@ -1,13 +1,14 @@
|
|||||||
Summary: Displays where a particular program in your path is located
|
Summary: Displays where a particular program in your path is located
|
||||||
Name: which
|
Name: which
|
||||||
Version: 2.21
|
Version: 2.21
|
||||||
Release: 24%{?dist}
|
Release: 25%{?dist}
|
||||||
License: GPLv3
|
License: GPLv3
|
||||||
Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz
|
Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz
|
||||||
Source1: which2.sh
|
Source1: which2.sh
|
||||||
Source2: which2.csh
|
Source2: which2.csh
|
||||||
Patch0: which-2.21-coverity-fixes.patch
|
Patch0: which-2.21-coverity-fixes.patch
|
||||||
Url: https://savannah.gnu.org/projects/which/
|
Url: https://savannah.gnu.org/projects/which/
|
||||||
|
Requires: coreutils
|
||||||
BuildRequires: make
|
BuildRequires: make
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
BuildRequires: readline-devel
|
BuildRequires: readline-devel
|
||||||
@ -40,6 +41,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir
|
|||||||
%{_mandir}/man1/which.1*
|
%{_mandir}/man1/which.1*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Apr 26 2021 Than Ngo <than@redhat.com> - 2.21-25
|
||||||
|
- improved which2.sh
|
||||||
|
|
||||||
* Tue Mar 23 2021 Than Ngo <than@redhat.com> - 2.21-24
|
* Tue Mar 23 2021 Than Ngo <than@redhat.com> - 2.21-24
|
||||||
- fixed regression if SHELL=zsh
|
- fixed regression if SHELL=zsh
|
||||||
|
|
||||||
|
16
which2.sh
16
which2.sh
@ -1,18 +1,18 @@
|
|||||||
# shellcheck shell=sh
|
# shellcheck shell=sh
|
||||||
# Initialization script for bash, sh, mksh and ksh
|
# Initialization script for bash, sh, mksh and ksh
|
||||||
|
|
||||||
_declare="declare -f"
|
which_declare="declare -f"
|
||||||
_opt="-f"
|
which_opt="-f"
|
||||||
_shell="$(basename $SHELL)"
|
which_shell="$(cat /proc/$$/comm)"
|
||||||
|
|
||||||
if [ "$_shell" = "ksh" ] || [ "$_shell" = "mksh" ] || [ "$_shell" = "zsh" ] ; then
|
if [ "$which_shell" = "ksh" ] || [ "$which_shell" = "mksh" ] || [ "$which_shell" = "zsh" ] ; then
|
||||||
_declare="typeset -f"
|
which_declare="typeset -f"
|
||||||
_opt=""
|
which_opt=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
which ()
|
which ()
|
||||||
{
|
{
|
||||||
(alias; eval ${_declare}) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot "$@"
|
(alias; eval ${which_declare}) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
export ${_opt} which
|
export ${which_opt} which
|
||||||
|
Loading…
Reference in New Issue
Block a user