From 05c976b156e8fbe3e3ffdf8e7528bf00af37a44d Mon Sep 17 00:00:00 2001 From: Kegan Maher Date: Thu, 28 Mar 2024 14:24:26 -0700 Subject: [PATCH] fix(reset): catch grep failure so script doesn't die with -e, the script returns an error code whenever any command does so, which can cause the rest of the Dev Container setup to fail grep returns an error code when no match is found, but we don't want that to end the script in error, so test the grep return code see https://stackoverflow.com/a/49627999/453168 --- bin/reset_db.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/reset_db.sh b/bin/reset_db.sh index 1b3ea0fd8..e2e3d76d9 100755 --- a/bin/reset_db.sh +++ b/bin/reset_db.sh @@ -23,7 +23,7 @@ else echo "DB_RESET is false, skipping" fi -valid_fixtures=$(echo "$DJANGO_DB_FIXTURES" | grep -e fixtures\.json$) +valid_fixtures=$(echo "$DJANGO_DB_FIXTURES" | grep -e fixtures\.json$ || test $? = 1) if [[ -n "$valid_fixtures" ]]; then # load data fixtures