mirror of
https://github.com/ohmybash/oh-my-bash.git
synced 2024-09-21 10:27:09 +00:00
tools/{,un}install: Quote arguments properly
This commit is contained in:
parent
b9b2c58c48
commit
c22b97e09a
@ -38,7 +38,7 @@ main() {
|
||||
set -e
|
||||
|
||||
if [ ! -n "$OSH" ]; then
|
||||
OSH=$HOME/.oh-my-bash
|
||||
OSH=~/.oh-my-bash
|
||||
fi
|
||||
|
||||
if [ -d "$OSH" ]; then
|
||||
@ -67,23 +67,23 @@ main() {
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
env git clone --depth=1 https://github.com/ohmybash/oh-my-bash.git $OSH || {
|
||||
env git clone --depth=1 https://github.com/ohmybash/oh-my-bash.git "$OSH" || {
|
||||
printf "Error: git clone of oh-my-bash repo failed\n"
|
||||
exit 1
|
||||
}
|
||||
|
||||
printf "${BLUE}Looking for an existing bash config...${NORMAL}\n"
|
||||
if [ -f $HOME/.bashrc ] || [ -h $HOME/.bashrc ]; then
|
||||
if [ -f ~/.bashrc ] || [ -h ~/.bashrc ]; then
|
||||
printf "${YELLOW}Found ~/.bashrc.${NORMAL} ${GREEN}Backing up to ~/.bashrc.pre-oh-my-bash${NORMAL}\n";
|
||||
mv $HOME/.bashrc $HOME/.bashrc.pre-oh-my-bash;
|
||||
mv ~/.bashrc ~/.bashrc.pre-oh-my-bash;
|
||||
fi
|
||||
|
||||
printf "${BLUE}Using the Oh My Bash template file and adding it to ~/.bashrc${NORMAL}\n"
|
||||
cp $OSH/templates/bashrc.osh-template $HOME/.bashrc
|
||||
cp "$OSH"/templates/bashrc.osh-template ~/.bashrc
|
||||
sed "/^export OSH=/ c\\
|
||||
export OSH=$OSH
|
||||
" $HOME/.bashrc > $HOME/.bashrc-ombtemp
|
||||
mv -f $HOME/.bashrc-ombtemp $HOME/.bashrc
|
||||
" ~/.bashrc > ~/.bashrc-ombtemp
|
||||
mv -f ~/.bashrc-ombtemp ~/.bashrc
|
||||
|
||||
# MOTD message :)
|
||||
printf '%s' "$GREEN"
|
||||
@ -95,7 +95,7 @@ export OSH=$OSH
|
||||
printf '%s\n' ' /____/ .... is now installed!'
|
||||
printf "%s\n" "Please look over the ~/.bashrc file to select plugins, themes, and options"
|
||||
printf "${BLUE}${BOLD}%s${NORMAL}\n" "To keep up on the latest news and updates, follow us on GitHub: https://github.com/ohmybash/oh-my-bash"
|
||||
exec bash; source $HOME/.bashrc
|
||||
exec bash; source ~/.bashrc
|
||||
}
|
||||
|
||||
|
||||
|
@ -7,22 +7,22 @@ if [ "$confirmation" != y ] && [ "$confirmation" != Y ]; then
|
||||
fi
|
||||
|
||||
echo "Removing ~/.oh-my-bash"
|
||||
if [ -d $HOME/.oh-my-bash ]; then
|
||||
rm -rf $HOME/.oh-my-bash
|
||||
if [ -d ~/.oh-my-bash ]; then
|
||||
rm -rf ~/.oh-my-bash
|
||||
fi
|
||||
|
||||
echo "Looking for original bash config..."
|
||||
if [ -f $HOME/.bashrc.pre-oh-my-bash ] || [ -h $HOME/.bashrc.pre-oh-my-bash ]; then
|
||||
if [ -f ~/.bashrc.pre-oh-my-bash ] || [ -h ~/.bashrc.pre-oh-my-bash ]; then
|
||||
echo "Found ~/.bashrc.pre-oh-my-bash -- Restoring to ~/.bashrc";
|
||||
|
||||
if [ -f $HOME/.bashrc ] || [ -h $HOME/.bashrc ]; then
|
||||
if [ -f ~/.bashrc ] || [ -h ~/.bashrc ]; then
|
||||
bashrc_SAVE=".bashrc.omb-uninstalled-$(date +%Y%m%d%H%M%S)";
|
||||
echo "Found ~/.bashrc -- Renaming to ~/${bashrc_SAVE}";
|
||||
mv $HOME/.bashrc $HOME/"${bashrc_SAVE}";
|
||||
mv ~/.bashrc ~/"${bashrc_SAVE}";
|
||||
fi
|
||||
|
||||
mv $HOME/.bashrc.pre-oh-my-bash $HOME/.bashrc;
|
||||
exec bash; source $HOME/.bashrc
|
||||
mv ~/.bashrc.pre-oh-my-bash ~/.bashrc;
|
||||
exec bash; source ~/.bashrc
|
||||
|
||||
echo "Your original bash config was restored. Please restart your session."
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user