From 37c034091846e423b31e07333c909dc07a3dbacc Mon Sep 17 00:00:00 2001 From: Alex Kollar Date: Tue, 3 Sep 2024 15:27:03 -0400 Subject: [PATCH] Fixed alias glitch (bash / zsh) --- install/install.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/install/install.sh b/install/install.sh index 987cf35..65c62a5 100755 --- a/install/install.sh +++ b/install/install.sh @@ -43,18 +43,23 @@ pip_install(){ } setup_aliases() { - local config_files=( ["bash"]="/home/$USER/.bashrc" ["zsh"]="/home/$USER/.zshrc" ) - config_path="${config_files[$SHELL]}" - declare -A aliases=( ["navi"]="source /opt/Navi/navienv/bin/activate && cd /opt/Navi/ && exec python3 ./navi_shell.py") for alias_name in "${!aliases[@]}"; do - if ! grep -q "alias $alias_name=" "$config_path"; then - echo "alias $alias_name='${aliases[$alias_name]}'" >> "$config_path" - echo "Navi alias added..." + if ! grep -q "alias $alias_name=" ~/.bashrc; then + echo "alias $alias_name='${aliases[$alias_name]}'" >> ~/.bashrc + echo "Navi alias added for bash..." else echo "Navi alias exists. Moving on." fi + + # You might also want to add the same alias to .zshrc if it's not already there: + if ! grep -q "alias $alias_name=" ~/.zshrc; then + echo "alias $alias_name='${aliases[$alias_name]}'" >> ~/.zshrc + echo "Navi alias added for zsh..." + else + echo "Navi alias exists for zsh. Moving on." + fi done } @@ -133,4 +138,4 @@ source_shell_config if [ "$LAUNCH_NAVI" = "true" ]; then source /opt/Navi/navienv/bin/activate && cd /opt/Navi/ && exec python3 ./navi_shell.py fi -exit \ No newline at end of file +exit