Skip to content

Commit

Permalink
fix remove left line in bashrc
Browse files Browse the repository at this point in the history
  • Loading branch information
Joey authored and igorpecovnik committed Dec 11, 2024
1 parent c0f1643 commit 83b7c80
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tools/modules/software/module_atuin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ EOL

echo "Updating .bashrc..."
if ! grep -q ". ~/.atuin/bin/env" "$atuin_bashrc_file"; then
echo ". ~/.atuin/bin/env" >> "$atuin_bashrc_file"
echo "Added . ~/.atuin/bin/env to .bashrc"
echo -e ". ~/.atuin/bin/env" >> "$atuin_bashrc_file"
#echo "Added . ~/.atuin/bin/env to .bashrc"
fi

# Ensure the user can update .bash-preexec.sh
Expand All @@ -147,12 +147,13 @@ EOL
wget -q https://raw.githubusercontent.com/rcaloras/bash-preexec/master/bash-preexec.sh -O "$bash_preexec_file" || { echo "Error: Failed to download .bash-preexec.sh" >&2; exit 1; }
fi
if ! grep -q '[[ -f ~/.bash-preexec.sh ]] && source ~/.bash-preexec.sh' "$atuin_bashrc_file"; then
echo '[[ -f ~/.bash-preexec.sh ]] && source ~/.bash-preexec.sh' >> "$atuin_bashrc_file"
echo ' ' >> "$atuin_bashrc_file"
echo -e '[[ -f ~/.bash-preexec.sh ]] && source ~/.bash-preexec.sh' >> "$atuin_bashrc_file"
fi

# Ensure eval "$(atuin init bash)" is in .bashrc
if ! grep -q 'eval "$(atuin init bash)"' "$atuin_bashrc_file"; then
echo 'eval "$(atuin init bash)"' >> "$atuin_bashrc_file"
echo -e '\neval "$(atuin init bash)"' >> "$atuin_bashrc_file"
fi

# Make sure all directories and files are owned by the user
Expand Down Expand Up @@ -195,6 +196,7 @@ remove_atuin() {

# Remove lines related to Atuin from .bashrc
echo "Removing Atuin references from .bashrc..."
sed -i '/\. ~\/\.atuin\/bin\/env/d' "$atuin_bashrc_file"
sed -i '/\[\[ -f ~\/.bash-preexec.sh \]\] && source ~\/.bash-preexec.sh/d' "$atuin_bashrc_file"
sed -i '/eval "\$(atuin init bash)"/d' "$atuin_bashrc_file"

Expand Down

0 comments on commit 83b7c80

Please sign in to comment.