From 3e557076eb364d60121a10f19042adce3ada2e8f Mon Sep 17 00:00:00 2001 From: Sighery Date: Thu, 13 Jul 2023 10:59:00 +0200 Subject: [PATCH] Use env bash to make script more portable Some systems might not have the `/bin/bash` link, they might just have a `/bin/sh` that detects whether to run `sh` or `bash` automatically. One example of this is NixOS, or the BSDs. Instead you can rely on the `env` utility to figure out where `bash` is, using the user's `PATH`. `env` will look into all the available paths and use the first path that matches the binary you're looking for, which should make this script more portable. --- docker_pullpush.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker_pullpush.sh b/docker_pullpush.sh index cb54074..de53d75 100755 --- a/docker_pullpush.sh +++ b/docker_pullpush.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash if [[ ${#6} -gt 0 ]]; then profile="--profile $6" @@ -11,4 +11,4 @@ fi docker pull $platform $1 aws ecr get-login-password --region $2 $profile | docker login --username AWS --password-stdin $3.dkr.ecr.$2.amazonaws.com docker tag $1 $3.dkr.ecr.$2.amazonaws.com/$4:$5 -docker push $3.dkr.ecr.$2.amazonaws.com/$4:$5 \ No newline at end of file +docker push $3.dkr.ecr.$2.amazonaws.com/$4:$5