From 2b8dbb67a781afee799467616dce623a23977c55 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Mon, 17 Apr 2023 12:40:18 -0700 Subject: [PATCH] scripts/warn-outside-container: fix escapes By default, echo does not interpret escape sequences, resulting in the following output (literal): \033[1mWARNING\033[0m: you are not in a container. I don't think this was intended. Add -e option to echo so it can work as intended. Also, use bash instead of sh because in POSIX shell echo does not take any options. Fixes: 94e08f2e2db2eb9 Signed-off-by: Kir Kolyshkin --- scripts/warn-outside-container | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/warn-outside-container b/scripts/warn-outside-container index b4ba8db235..4edefcf264 100755 --- a/scripts/warn-outside-container +++ b/scripts/warn-outside-container @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash set -eu target="${1:-}" @@ -11,14 +11,14 @@ if [ -z "${DISABLE_WARN_OUTSIDE_CONTAINER:-}" ]; then *) ( echo - echo "\033[1mWARNING\033[0m: you are not in a container." + echo -e "\033[1mWARNING\033[0m: you are not in a container." echo - echo 'Use "\033[1mmake dev\033[0m" to start an interactive development container,' - echo "use \"\033[1mmake -f docker.Makefile $target\033[0m\" to execute this target" - echo "in a container, or set \033[1mDISABLE_WARN_OUTSIDE_CONTAINER=1\033[0m to" - echo "disable this warning." + echo -e 'Use "\033[1mmake dev\033[0m" to start an interactive development container,' + echo -e "use \"\033[1mmake -f docker.Makefile $target\033[0m\" to execute this target" + echo -e "in a container, or set \033[1mDISABLE_WARN_OUTSIDE_CONTAINER=1\033[0m to" + echo -e "disable this warning." echo - echo "Press \033[1mCtrl+C\033[0m now to abort, or wait for the script to continue.." + echo -e "Press \033[1mCtrl+C\033[0m now to abort, or wait for the script to continue.." echo ) >&2 sleep 5