Steve: This approach is probably safer than just the warning note that I put in, but the list of files to be deleted is 21 printed pages, so it may not be practical to have that scroll across the screen. You couldn't really review it.
Maybe a pre-clean-out script to run the find command and output the list to a file for review? Or a Perl script to do the same with some filtering of the list? James On Thu, Oct 23, 2014 at 6:21 AM, Steve Cookson <steve.cook...@sca-uk.com> wrote: > Hi James, > > Actually, I've changed my mind, what about something recursive like > this (I called it test.sh and it calls itself with a file redirect in it. > We just type sh test.sh): > > #!/bin/bash > # > > if [ -z "$1" ] > then > echo "These directories will be deleted:\n"; > # > # > # Put code to list directories here > # > # > read -p "Do you wish to continue? " yn > case $yn in > [Yy]* ) sh test.sh "Y" > testlogfile.txt; exit;; > [Nn]* ) echo "Exit without changing anything."; exit;; > * ) echo "Please answer yes or no.";; > esac > > fi > > echo "Do all the install work"; > # > # > # Put code to install wx here > # > # > echo "Finished."; > > > What do you think? > > Regards > > Steve. > On 22-10-2014 18:05, James Lynes wrote: > > Hi Steve: > > Attached is the revised script. > > I had a problem the first time I ran it as a prompt was asked for but not > seen as it was sent to the log file. The process hung at that point since > the prompt wasn't responded to. > > So, now I have everything going to both the screen and the log file. If > you know a better way, let me know. I'd rather not have all the compile > stuff going to the screen. I am not a shell guru! > > I changed the find root directory and added a warning statement also. > > James > > > On Mon, Oct 20, 2014 at 4:18 PM, Steve Cookson <steve.cook...@sca-uk.com> > wrote: > >> Hi James, >> >> On 20-10-2014 21:05, James Lynes wrote: >> >>> I don't see where any unrelated packages were effected. It seems that it >>> would be prudent to begin the find at /usr/local/. >>> >> Your respondent was right. I always loose Flamerobin (the Firebird >> database manager) and have to reinstall it afterwards, which is why you see >> it reinstalling afterwards in some of my scripts. >> >> But of course it may not now that we are only interested in /local/. >> >> If we listed the directories like you have, and warned the user (Do you >> wish to continue, yes or no?). Then the user can realise that, for >> instance, Flamerobin would be deleted before it's too late and update the >> script accordingly. >> >> Regards >> >> Steve. >> > > >