Fixed syntax error in update_path.sh

This commit is contained in:
ajasibley 2023-05-25 02:13:01 -07:00
parent 28491b7515
commit 61cd6685f4

View file

@ -1,19 +1,19 @@
#!/bin/bash
# Get the current shell name
current_shell="$(basename ${builtins.getEnv "SHELL"})"
current_shell="$(basename "$SHELL")"
# Update the corresponding configuration file based on the current shell
if [[ "$current_shell" == "bash" ]]; then
cat >> "${builtins.getEnv "HOME"}/.bashrc" <<EOF
export PATH="/Users/test/.cosmo/bin:\${builtins.getEnv "PATH"}"
cat >> "${HOME}/.bashrc" <<EOF
export PATH="/Users/test/.cosmo/bin:\${PATH}"
EOF
source "${builtins.getEnv "HOME"}/.bashrc"
source "${HOME}/.bashrc"
elif [[ "$current_shell" == "zsh" ]]; then
cat >> "${builtins.getEnv "HOME"}/.zshrc" <<EOF
export PATH="/Users/test/.cosmo/bin:\${builtins.getEnv "PATH"}"
cat >> "${HOME}/.zshrc" <<EOF
export PATH="/Users/test/.cosmo/bin:\${PATH}"
EOF
source "${builtins.getEnv "HOME"}/.zshrc"
source "${HOME}/.zshrc"
else
echo "Unsupported shell: $current_shell"
exit 1