From: Steve Dickson <steved@redhat.com>
To: Petr Vorel <pvorel@suse.cz>, linux-nfs@vger.kernel.org
Cc: Jianhong Yin <yin-jianhong@163.com>
Subject: Re: [PATCH 1/1] install-dep: Use command -v instead of which
Date: Thu, 23 Sep 2021 12:36:09 -0400 [thread overview]
Message-ID: <3e9b74e5-4a83-78cf-bd45-af2db4ebb790@redhat.com> (raw)
In-Reply-To: <20210920152505.9423-1-pvorel@suse.cz>
On 9/20/21 11:25 AM, Petr Vorel wrote:
> `command -v' is shell builtin required by POSIX [1] and supported on all
> common shells (bash, zsh, dash, busybox sh, mksh). `which' utility is not
> presented on some containers (e.g. Fedora, openSUSE), also going to be
> removed from future Debian versions.
>
> Also remove stderr redirection to /dev/null as it's unnecessary when
> using 'command': POSIX says "no output shall be written" if the command
> isn't found.
>
> [1] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html
> [2] https://salsa.debian.org/debian/debianutils/-/commit/3a8dd10b4502f7bae8fc6973c13ce23fc9da7efb
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
Committed... (tag: nfs-utils-2-5-5-rc3)
steved.
> ---
> install-dep | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/install-dep b/install-dep
> index 621618fe..4698d44a 100755
> --- a/install-dep
> +++ b/install-dep
> @@ -2,20 +2,20 @@
> #install dependencies for compiling from source code
>
> #RHEL/Fedora/CentOS-Stream/Rocky
> -which dnf &>/dev/null || which yum &>/dev/null && {
> +command -v dnf >/dev/null || command -v yum >/dev/null && {
> yum install -y automake libtool make gcc rpcgen libtirpc-devel libevent-devel sqlite-devel device-mapper-devel \
> libblkid-devel krb5-devel libuuid-devel
> }
>
> #Debian/ubuntu
> -which apt &>/dev/null && {
> +command -v apt >/dev/null && {
> apt install -o APT::Install-Suggests=0 -o APT::Install-Recommends=0 --ignore-missing -y \
> autotools-dev automake make libtool pkg-config libtirpc-dev libevent-dev libsqlite3-dev \
> libdevmapper-dev libblkid-dev libkrb5-dev libkeyutils-dev uuid-dev
> }
>
> #openSUSE Leap
> -which zypper &>/dev/null && {
> +command -v zypper >/dev/null && {
> zypper in --no-recommends -y automake libtool make gcc rpcgen libtirpc-devel libevent-devel sqlite-devel \
> device-mapper-devel libblkid-devel krb5-devel libuuid-devel
> }
>
prev parent reply other threads:[~2021-09-23 16:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-20 15:25 [PATCH 1/1] install-dep: Use command -v instead of which Petr Vorel
2021-09-20 15:29 ` Petr Vorel
2021-09-23 16:36 ` Steve Dickson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3e9b74e5-4a83-78cf-bd45-af2db4ebb790@redhat.com \
--to=steved@redhat.com \
--cc=linux-nfs@vger.kernel.org \
--cc=pvorel@suse.cz \
--cc=yin-jianhong@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).