improved which2.sh
This commit is contained in:
parent
22890a8cdd
commit
0d4e65631b
@ -1,7 +1,7 @@
|
|||||||
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: 22%{?dist}
|
Release: 23%{?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
|
||||||
@ -40,6 +40,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir
|
|||||||
%{_mandir}/man1/which.1*
|
%{_mandir}/man1/which.1*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sun Mar 21 2021 Than Ngo <than@redhat.com> - 2.21-23
|
||||||
|
- improved which2.sh
|
||||||
|
|
||||||
* Thu Mar 18 2021 Than Ngo <than@redhat.com> - 2.21-22
|
* Thu Mar 18 2021 Than Ngo <than@redhat.com> - 2.21-22
|
||||||
- Resolves: #1940464, fixed syntax error testcase: a=b which ls
|
- Resolves: #1940464, fixed syntax error testcase: a=b which ls
|
||||||
|
|
||||||
|
19
which2.sh
19
which2.sh
@ -1,11 +1,16 @@
|
|||||||
# Initialization script for bash, sh, mksh and ksh
|
# Initialization script for bash, sh, mksh and ksh
|
||||||
|
|
||||||
|
_declare="declare -f"
|
||||||
|
_opt="-f"
|
||||||
|
|
||||||
|
if [ "$0" = "ksh" ] || [ "$0" = "-ksh" ] || [ "$0" = "mksh" ] || [ "$0" = "-mksh" ] ; then
|
||||||
|
_declare="typeset -f"
|
||||||
|
_opt=""
|
||||||
|
fi
|
||||||
|
|
||||||
which ()
|
which ()
|
||||||
{
|
{
|
||||||
if [ "$0" = "ksh" -o "$0" = "-ksh" -o "$0" = "mksh" -o "$0" = "-mksh" ] ; then
|
(alias; eval ${_declare}) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot "$@"
|
||||||
(alias; typeset -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@
|
|
||||||
export which
|
|
||||||
else
|
|
||||||
(alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@
|
|
||||||
export -f which
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export ${_opt} which
|
||||||
|
Loading…
Reference in New Issue
Block a user