From 2333878db3e500f769b68660b5aa96dd52947cd7 Mon Sep 17 00:00:00 2001 From: mannem srinivas Date: Mon, 16 Sep 2024 14:57:49 +0530 Subject: [PATCH] Update install.sh --- install.sh | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/install.sh b/install.sh index 342aad7..fdc90ac 100755 --- a/install.sh +++ b/install.sh @@ -464,35 +464,35 @@ nvm_do_install() { # Define the code to add to the shell configuration file CODE=$(cat <<'EOF' - # Function to get current node version - get_node_version() { - if command -v node >/dev/null 2>&1; then - echo "(node $(node -v))" - fi - } - - # Update prompt based on the shell (bash or zsh) - if [ "$SHELL" = "/bin/bash" ] || [ "$SHELL" = "/usr/bin/bash" ]; then - # For bash - echo "Setting up for bash..." - - # Add dynamic prompt setup for bash - PROMPT_COMMAND='PS1="\u@\h \w \$(get_node_version)$ "' - export PROMPT_COMMAND - - elif [ "$SHELL" = "/bin/zsh" ] || [ "$SHELL" = "/usr/bin/zsh" ]; then - # For zsh - echo "Setting up for zsh..." - - # Set the prompt dynamically in zsh - precmd() { - PS1='%n@%m %~ $(get_node_version)$ ' + # Function to get current node version + get_node_version() { + if command -v node >/dev/null 2>&1; then + echo "(node $(node -v))" + fi } - export -f precmd - # Enable prompt substitution in zsh - setopt promptsubst - fi + # Update prompt based on the shell (bash or zsh) + if [ "$SHELL" = "/bin/bash" ] || [ "$SHELL" = "/usr/bin/bash" ]; then + # For bash + echo "Setting up for bash..." + + # Add dynamic prompt setup for bash + PROMPT_COMMAND='PS1="\u@\h \w \$(get_node_version)$ "' + export PROMPT_COMMAND + + elif [ "$SHELL" = "/bin/zsh" ] || [ "$SHELL" = "/usr/bin/zsh" ]; then + # For zsh + echo "Setting up for zsh..." + + # Set the prompt dynamically in zsh + precmd() { + PS1='%n@%m %~ $(get_node_version)$ ' + } + export -f precmd + + # Enable prompt substitution in zsh + setopt promptsubst + fi EOF )