-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·26 lines (22 loc) · 1013 Bytes
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash
echo "Installing script to $HOME/.grind..."
# Easiest to do everything relative to $HOME. Make the directory,
# download the script into that directory, and then make it executable
cd $HOME
mkdir .grind
curl https://raw.githubusercontent.com/brandon-gong/grind/main/grind -o .grind/grind -s
chmod +x .grind/grind
# Try adding it to the PATH. TODO these aren't properly tested, besides
# fish on my macOS machine.
echo "Adding installation location to path..."
USER_SHELL="$(basename $SHELL)"
if [ $USER_SHELL == "bash" ]; then
echo -e "export PATH=$HOME/.grind:\$PATH" >> .bashrc
elif [ $USER_SHELL == "zsh" ]; then
echo -e "export PATH=$HOME/.grind:\$PATH" >> .zshrc
elif [ $USER_SHELL == "fish" ]; then
echo -e "set PATH $HOME/.grind \$PATH" >> .config/fish/config.fish
else
echo "WARNING: Did not recognize shell $USER_SHELL; you'll need to manually add $HOME/.grind to your PATH to run grind from anywhere."
fi
echo "Done! You'll need to restart your terminal for changes to take effect."