Commit 2c1e1cc7 authored by jaster's avatar jaster
Browse files

bin/dev.sh: Improve shell detection

Shell detection used hardcoded paths that made it fail when using
distributions using a different scheme (e.g. debian-based distros).

Improve shell detection by using a glob-based comparison, where we do
not assume any specific path leading to the shell binary.
parent bd1d38ff
...@@ -16,19 +16,21 @@ echo "alias memopol-launch=\"memopol-code && memopol runserver\"" >> $ALIASROOT ...@@ -16,19 +16,21 @@ echo "alias memopol-launch=\"memopol-code && memopol runserver\"" >> $ALIASROOT
echo "alias memopol-update-all=\"memopol-code && bin/update-all\"" >> $ALIASROOT echo "alias memopol-update-all=\"memopol-code && bin/update-all\"" >> $ALIASROOT
echo "alias memopol-refresh-scores=\"memopol-code && memopol refresh_scores\"" >> $ALIASROOT echo "alias memopol-refresh-scores=\"memopol-code && memopol refresh_scores\"" >> $ALIASROOT
if [ $SHELL = "/bin/bash" ] case $SHELL in
then */bash)
echo "Bash detected" echo "Bash detected"
echo "Update $HOME/.bashrc file" echo "Update $HOME/.bashrc file"
RCSHELL="$HOME/.bashrc" RCSHELL="$HOME/.bashrc"
elif [ $SHELL = "/bin/zsh" ] ;;
then */zsh)
echo "Zsh detected" echo "Zsh detected"
echo "Update $HOME/.zshrc file" echo "Update $HOME/.zshrc file"
RCSHELL="$HOME/.zshrc" RCSHELL="$HOME/.zshrc"
else ;;
*)
echo "SHELL don't supported. Try using BASH or ZSH, or manually." echo "SHELL don't supported. Try using BASH or ZSH, or manually."
fi ;;
esac
echo "source $ALIASROOT" >> $RCSHELL echo "source $ALIASROOT" >> $RCSHELL
source $ALIASROOT source $ALIASROOT
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment