Message ID | 20210122102748.38776-2-omosnace@redhat.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Ondrej Mosnáček |
Headers | show |
Series | Migrate CI to GH Actions | expand |
On Fri, Jan 22, 2021 at 5:46 AM Ondrej Mosnacek <omosnace@redhat.com> wrote: > > In minimal environments (e.g. Fedora container image) 'which' is not > installed by default. To avoid the need to install an additional > dependency, use 'command -v', which also does the trick and is a shell > builtin. > > Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com> > --- > tools/check-syntax | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Nice. Acked-by: Paul Moore <paul@paul-moore.com>
diff --git a/tools/check-syntax b/tools/check-syntax index 0ca79e2..2115a79 100755 --- a/tools/check-syntax +++ b/tools/check-syntax @@ -27,7 +27,7 @@ CHK_PERL_EXCLUDE="" # function verify_deps() { [[ -z "$1" ]] && return - if ! which "$1" >& /dev/null; then + if ! command -v "$1" >& /dev/null; then echo "error: install \"$1\" and include it in your \$PATH" exit 1 fi
In minimal environments (e.g. Fedora container image) 'which' is not installed by default. To avoid the need to install an additional dependency, use 'command -v', which also does the trick and is a shell builtin. Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com> --- tools/check-syntax | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)