Add -s flag to which
In my work place we use many shellscripts written for BSD/Mac. They often use the which -s flag to check if a command is installed, such as which -s java || echo "You have to install java to run this program"
The -s flag is described on the FreeBSD man-page https://www.freebsd.org/cgi/man.cgi?which(1)
I would like the which -s command in shellscripts written for BSD to also work in Debian. This Merge request therefor adds the -s flag to the which command, to become compatible BSD/Mac shellscripts.
Merge request reports
Activity
- Resolved by Geert Stappers
Highlight @clint for creating awareness of this merge request.
The MR does not break any thing. Helps those who are used to the
-s
flag. And even does- while getopts a whichopts + while getopts as whichopts
mentioned in commit 8eaf8975
My objection was here: https://lists.debian.org/debian-devel/2020/08/msg00149.html
Text from that URL
On Wed, Aug 19, 2020 at 01:45:05PM +0000, Clint Adams wrote:
On Tue, Aug 18, 2020 at 10:55:41AM -0400, Boyuan Yang wrote: > In theory any Debian Developers may merge, but the debianutils package is > maintained by clint@ and srivasta@ so they are responsible for this package. I > am adding them to the email receiver list explicitly. Now that `command -v` is mandated by POSIX, it would make more sense to transition `which` out of debianutils.
Hi Clint and Geert!
Clint: What you really cared about is not having "which" inside debianutils, and not whatever it has a -s(silent) flag or not? (I guess?)
So merging the -s flag, should not be a problem, but what you want is to have "which" moved away from debianutils, and into another (maybe optional) package? I guess that can be done?
Best regards -Erik
Den lör 5 juni 2021 kl 21:30 skrev Geert Stappers (@stappers) < gitlab@salsa.debian.org>:
What I can do is, after the release of Debian 11.0, slap a deprecation warning on
which
at the same time I removetempfile
from the package. If a new package or multiple packages supply a /usr/bin/which executable or alternatives, with or without an -s flag, then debianutils can declare a transitional dependency and drop its ownwhich
. If not,which
can be dropped immediately after the release of Debian 12.0.In https://lists.debian.org/debian-devel/2021/08/msg00236.html got this revived.
FYI
- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=992539 ITP packaging gnu-which
-
http://cvs.savannah.gnu.org/viewvc/which/which/which.texi?revision=1.1&view=markup has no
-s