File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7575
7676fi
7777
78+ # Comment out /root/.bashrc
79+ BASHRC_FILE=" /root/.bashrc"
80+
81+ # Lines to search for
82+ NVM_LINES=(
83+ ' export NVM_DIR="$HOME/.nvm"'
84+ ' [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"'
85+ ' [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"'
86+ )
87+
88+ # Iterate over each line and comment it out if not already commented
89+ for line in " ${NVM_LINES[@]} " ; do
90+ # Escape special characters in the line for use in grep and sed
91+ escaped_line=$( printf ' %s\n' " $line " | sed ' s/[.[\*^$(){}?+|]/\\&/g' )
92+
93+ # Check if the line exists and is not already commented
94+ if grep -q " $escaped_line " " $BASHRC_FILE " && ! grep -q " # $escaped_line " " $BASHRC_FILE " ; then
95+ sed -i " s|$escaped_line |# $line |" " $BASHRC_FILE "
96+ echo " Commented out: $line "
97+ else
98+ echo " Line not found or already commented: $line "
99+ fi
100+ done
101+
78102# Notify installation has finished
79103/usr/local/hestia/bin/v-add-user-notification admin NodeApp " <span style=\" font-size:large;color:green;\" >⬢</span> NodeApp plugin has finished installing."
You can’t perform that action at this time.
0 commit comments