Skip to content

Commit

Permalink
Fixed alias glitch (bash / zsh)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKollar committed Sep 3, 2024
1 parent 2b5955a commit 37c0340
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions install/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
exit

0 comments on commit 37c0340

Please sign in to comment.