From 79b098db9f8b46b4bc6a590cdc5c3fe066a50318 Mon Sep 17 00:00:00 2001 From: Carter Canedy Date: Wed, 11 Sep 2024 09:30:08 -0700 Subject: [PATCH] try to make echo usage as posix compliant as possible --- setup.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/setup.sh b/setup.sh index ffd1ebf..4c2ca5d 100755 --- a/setup.sh +++ b/setup.sh @@ -1,5 +1,14 @@ #!/bin/sh -e +# Make sure that echo is posix compliant +echo() { + if [ ! "$BASH_VERSION" = "" ]; then + /usr/bin/env echo -e "$@" + else + /usr/bin/env echo "$@" + fi +} + RC='\033[0m' RED='\033[31m' YELLOW='\033[33m' @@ -255,11 +264,11 @@ linkConfig() { touch "$CURRENT_BASHRC" fi - if cat "$CURRENT_BASHRC" | grep -q ". $GITPATH/.bashrc"; then + if grep -q ". $GITPATH/.bashrc" < "$CURRENT_BASHRC" ; then echo "Bash config is already being sourced${RC}" else echo "Appending to current bash config" - cat >> $CURRENT_BASHRC << EOF + cat >> "$CURRENT_BASHRC" << EOF ## ChrisTitusTech's bash config . $GITPATH/.bashrc