Skip to content

Commit

Permalink
try to make echo usage as posix compliant as possible
Browse files Browse the repository at this point in the history
  • Loading branch information
cartercanedy committed Sep 11, 2024
1 parent bc2ac3f commit 79b098d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 79b098d

Please # to comment.