forked from zstenger93/42_minishell_tester
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
34 lines (23 loc) · 749 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
27
28
29
30
31
32
33
34
#!/bin/bash
cd $HOME
rm -rf 42_minishell_tester
mkdir 42_minishell_tester_tmp
cd 42_minishell_tester_tmp
git clone https://github.com/atuuuu/42_minishell_tester.git
cp -r 42_minishell_tester $HOME
cd $HOME
rm -rf 42_minishell_tester_tmp
cd $HOME/42_minishell_tester
chmod +x $HOME/42_minishell_tester/tester.sh
RC_FILE=$HOME/.zshrc
if [[ "$SHELL" == *"bash"* ]]; then # works no matter path is /usr/bin/bash or /bin/bash
RC_FILE="$HOME/.bashrc"
elif [[ "$SHELL" == *"zsh"* ]]; then
RC_FILE="$HOME/.zshrc"
fi
if ! grep "mstest=" $RC_FILE &> /dev/null; then
echo "mstest alias not present"
echo "Adding alias in file: $RC_FILE"
echo -e "\nalias mstest=\"bash $HOME/42_minishell_tester/tester.sh\"\n" >> $RC_FILE
fi
exec $SHELL