Skip to content

Commit 83b7c80

Browse files
Joeyigorpecovnik
authored andcommitted
fix remove left line in bashrc
1 parent c0f1643 commit 83b7c80

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tools/modules/software/module_atuin.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ EOL
137137

138138
echo "Updating .bashrc..."
139139
if ! grep -q ". ~/.atuin/bin/env" "$atuin_bashrc_file"; then
140-
echo ". ~/.atuin/bin/env" >> "$atuin_bashrc_file"
141-
echo "Added . ~/.atuin/bin/env to .bashrc"
140+
echo -e ". ~/.atuin/bin/env" >> "$atuin_bashrc_file"
141+
#echo "Added . ~/.atuin/bin/env to .bashrc"
142142
fi
143143

144144
# Ensure the user can update .bash-preexec.sh
@@ -147,12 +147,13 @@ EOL
147147
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; }
148148
fi
149149
if ! grep -q '[[ -f ~/.bash-preexec.sh ]] && source ~/.bash-preexec.sh' "$atuin_bashrc_file"; then
150-
echo '[[ -f ~/.bash-preexec.sh ]] && source ~/.bash-preexec.sh' >> "$atuin_bashrc_file"
150+
echo ' ' >> "$atuin_bashrc_file"
151+
echo -e '[[ -f ~/.bash-preexec.sh ]] && source ~/.bash-preexec.sh' >> "$atuin_bashrc_file"
151152
fi
152153

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

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

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

0 commit comments

Comments
 (0)