Skip to content

Commit

Permalink
fix(install): add new line to file (#2042)
Browse files Browse the repository at this point in the history
  • Loading branch information
rxri committed Dec 5, 2022
1 parent 447f93b commit b2ee835
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ export PATH="\$PATH:$spicetify_install"
EOINFO
}

endswith_newline() {
[[ $(tail -c1 "$1" | wc -l) -gt 0 ]]
}

check() {
local path="export PATH=\$PATH:$spicetify_install"
local shellrc=$HOME/$1
Expand All @@ -76,6 +80,9 @@ check() {
if [ -f $shellrc ]; then
if ! grep -q $spicetify_install $shellrc; then
echo "APPENDING $spicetify_install to PATH in $shellrc"
if ! endswith_newline $shellrc; then
echo >> $shellrc
fi
echo ${2:-$path} >> $shellrc
echo "Restart your shell to have spicetify in your PATH."
else
Expand Down

0 comments on commit b2ee835

Please sign in to comment.