mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-27 20:57:40 +00:00
Merge pull request #1805 from ahankinson/fix-issue1359
Fix #1539: Figure out the best shell config file
This commit is contained in:
+40
-12
@@ -48,19 +48,47 @@ function ask_append_shell_config () {
|
||||
config_string="$1"
|
||||
|
||||
shell_config_file=""
|
||||
# use order outlined by http://hayne.net/MacDev/Notes/unixFAQ.html#shellStartup
|
||||
if [ -f "$HOME/.bash_profile" ]; then
|
||||
shell_config_file="$HOME/.bash_profile"
|
||||
elif [ -f "$HOME/.bash_login" ]; then
|
||||
shell_config_file="$HOME/.bash_login"
|
||||
elif [ -f "$HOME/.profile" ]; then
|
||||
shell_config_file="$HOME/.profile"
|
||||
elif [ -f "$HOME/.bashrc" ]; then
|
||||
shell_config_file="$HOME/.bashrc"
|
||||
elif [ -f "$HOME/.zshrc" ]; then
|
||||
shell_config_file="$HOME/.zshrc"
|
||||
fi
|
||||
|
||||
if [[ "$SHELL" == *zsh* ]]; then
|
||||
if [ -f "$HOME/.zshrc" ]; then
|
||||
shell_config_file="$HOME/.zshrc"
|
||||
elif [ -f "$HOME/.profile" ]; then
|
||||
shell_config_file="$HOME/.profile"
|
||||
else
|
||||
touch "$HOME/.profile"
|
||||
shell_config_file="$HOME/.zshrc"
|
||||
fi
|
||||
elif [[ "$SHELL" == *bash* ]]; then
|
||||
if [ -f "$HOME/.bash_profile" ]; then
|
||||
shell_config_file="$HOME/.bash_profile"
|
||||
elif [ -f "$HOME/.bash_login" ]; then
|
||||
shell_config_file="$HOME/.bash_login"
|
||||
elif [ -f "$HOME/.bashrc" ]; then
|
||||
shell_config_file="$HOME/.bashrc"
|
||||
elif [ -f "$HOME/.profile" ]; then
|
||||
shell_config_file="$HOME/.profile"
|
||||
else
|
||||
touch "$HOME/.profile"
|
||||
shell_config_file="$HOME/.profile"
|
||||
fi
|
||||
else
|
||||
echo " Could not automatically determine your shell. Looking for other configuration possibilities."
|
||||
# use order outlined by http://hayne.net/MacDev/Notes/unixFAQ.html#shellStartup
|
||||
if [ -f "$HOME/.bash_profile" ]; then
|
||||
shell_config_file="$HOME/.bash_profile"
|
||||
elif [ -f "$HOME/.bash_login" ]; then
|
||||
shell_config_file="$HOME/.bash_login"
|
||||
elif [ -f "$HOME/.bashrc" ]; then
|
||||
shell_config_file="$HOME/.bashrc"
|
||||
elif [ -f "$HOME/.zshrc" ]; then
|
||||
shell_config_file="$HOME/.zshrc"
|
||||
elif [ -f "$HOME/.profile" ]; then
|
||||
shell_config_file="$HOME/.profile"
|
||||
else
|
||||
touch "$HOME/.profile"
|
||||
shell_config_file="$HOME/.profile"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo " \"$config_string\" will be appended to \"$shell_config_file\"."
|
||||
if prompt "no"; then
|
||||
|
||||
Reference in New Issue
Block a user