Improve shellscript portability by using /bin/env (#4628)

Using `/bin/env` increases portability for the shell scripts (and often using `/bin/env` is requested by e.g. Mac users). This would also facilitate testing scripts with different Bash versions via the Bash containers, as they have bash in `/usr/local` and not `/bin`. Using `/bin/env`, there is no need to change the script when testing. (I assume the latter was behind c301ea214b (diff-ecec5e3a811f60bc2739019004fa35b0), which would not happen using `/bin/env`.)

Signed-off-by: Joakim Roubert <joakimr@axis.com>
This commit is contained in:
Joakim Roubert 2020-06-19 21:49:29 +02:00 committed by GitHub
parent 84a29b9612
commit 8d19b4055b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
57 changed files with 63 additions and 57 deletions

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env sh
set -eu
# build debug logging is disabled by default; enable with BUILD_DEBUG=1

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# shellcheck disable=SC2120
# (disabling SC2120 so that we can use functions with optional args
# see https://github.com/koalaman/shellcheck/wiki/SC2120#exceptions )

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# This file is a collection of helper functions for running integration tests.
# It is used primarily by `bin/test-run` and ci.

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env sh
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -o errexit
set -o nounset

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env sh
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env sh
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Builds (or pulls) our base runtime docker image.

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Builds (or pulls) our go-deps docker image.

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env sh
# If the first argument to this script is "latest" or unset, it fetches the
# latest proxy binary from the linkerd2-proxy github releases. If it's set to

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env sh
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env sh
set -eu
cd "$(pwd -P)"

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env sh
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env sh
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -e

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
### Install PR ###
#

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env sh
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -eo pipefail

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env sh
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env sh
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env sh
set -eu

View File

@ -1,4 +1,6 @@
#!/bin/sh -eu
#!/usr/bin/env sh
set -eu
bindir=$( cd "${0%/*}" && pwd )
rootdir=$( cd "$bindir"/.. && pwd )

View File

@ -1,4 +1,6 @@
#!/bin/sh -eu
#!/usr/bin/env sh
set -eu
bindir=$( cd "${0%/*}" && pwd )

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env sh
# A wrapper for interacting with minikube.
#

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env sh
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env sh
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
bindir=$( cd "${0%/*}" && pwd )

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env sh
set -eu

View File

@ -1,4 +1,6 @@
#!/bin/sh -eu
#!/usr/bin/env sh
set -eu
bindir=$( cd "${0%/*}" && pwd )
rootdir=$( cd "$bindir"/.. && pwd )

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Run integration tests on 4 cloud providers:

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Cleans up integration tests from 4 cloud providers:

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# This script executes the full suite of integration tests, in series:
# 1. upgrade_stable_integration_tests

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# This test script deploys the following:
# - 1 Linkerd control-plane

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env sh
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -o errexit -o nounset -o pipefail

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env sh
# Copyright (c) 2018 Tigera, Inc. All rights reserved.
# Copyright 2018 Istio Authors
# Modifications copyright (c) Linkerd authors

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env sh
set -eu
if [ -z "${LINKERD2_PROXY_IDENTITY_DISABLED:-}" ]; then