From 147eff27785380412afb352aa9dc050554887fa0 Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Thu, 29 Dec 2011 11:31:11 +0100 Subject: Allow running bootstrap.sh with a --force or -f option This avoids the confirmation prompt. --- bootstrap.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 0d03922..89642fb 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -2,9 +2,17 @@ mkdir -p ~/.vim/{backups,swaps,undo} cd "$(dirname "$0")" git pull -read -p "This may overwrite existing files in your home directory. Are you sure? (y/n) " -n 1 -echo -if [[ $REPLY =~ ^[Yy]$ ]]; then +function doIt() { rsync --exclude ".git/" --exclude ".DS_Store" --exclude "bootstrap.sh" --exclude "README.md" -av . ~ +} +if [ "$1" == "--force" -o "$1" == "-f" ]; then + doIt +else + read -p "This may overwrite existing files in your home directory. Are you sure? (y/n) " -n 1 + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + doIt + fi fi -source "$HOME/.bash_profile" \ No newline at end of file +unset doIt +source ~/.bash_profile \ No newline at end of file -- cgit v1.2.3