From 484fc2747f4749f5fd4a267b30dac2ccee795e37 Mon Sep 17 00:00:00 2001 From: Michael Brewer Date: Sun, 9 Jun 2024 09:40:30 -0700 Subject: [PATCH] feat: check if grep is installed --- code-server/run.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/code-server/run.sh b/code-server/run.sh index d66dcf6..84a37cd 100755 --- a/code-server/run.sh +++ b/code-server/run.sh @@ -29,11 +29,15 @@ function extension_installed() { if [ ! -f "$EXTENSIONS_FILE" ]; then return 1 fi - if grep -q "\"$1\"" "$EXTENSIONS_FILE"; then - echo "Extension $1 was found in $EXTENSIONS_FILE." - return 0 + if ! command -v grep > /dev/null; then + return 1 + fi + if ! grep -q "\"$1\"" "$EXTENSIONS_FILE"; then + return 1 fi - return 1 + + echo "Extension $1 was found in $EXTENSIONS_FILE." + return 0 } # Check if the settings file exists...