From: Peng Li Date: Wed, 22 Jun 2016 17:33:25 +0000 (+0800) Subject: emacs - improve the install.pl X-Git-Url: http://47.100.26.94:8080/?a=commitdiff_plain;ds=sidebyside;h=e42deffac9a03698d32dce0d91c66c91796085e8;p=dotfiles.git emacs - improve the install.pl --- diff --git a/emacs.d/install.pl b/emacs.d/install.pl index 0fbe57e..333531a 100755 --- a/emacs.d/install.pl +++ b/emacs.d/install.pl @@ -4,12 +4,21 @@ use 5.010; use strict; ##my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime; -my $date = `date +%m%d`; -chomp $date; +chomp (my $date = `date +%m%d`); if (-e "$ENV{HOME}/.emacs.d" ) { - say "~/.emacs.d folder already exists, rename as ~/.emacs.d_bak_$date"; - ! system "mv", "$ENV{HOME}/.emacs.d", "$ENV{HOME}/.emacs.d_bak_$date" or die; + print "~/.emacs.d folder already exists.\nRename as ~/.emacs.d_bak_$date and continue yes (y) or no (n)? "; + chomp (my $yorn = ); + + while ($yorn ne "y" and $yorn ne "n") { + print "Input y or n: "; + chomp ($yorn = ); + } + + exit if $yorn eq "n"; + + ! system "mv", "$ENV{HOME}/.emacs.d", "$ENV{HOME}/.emacs.d_bak_$date" or die + if $yorn eq "y"; } ## link emacs.d folder