#!/bin/bash # # optinst allows you to view a set of files and choose whether to copy each one # to a target directory in original or edited form, or not. # # Copyright (C) 2018 Tim Chadburn # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Author's email: tim@orbitalwintersong.org.uk prefix=@prefix@ datarootdir=@datarootdir@ if [[ ! -a ~/.snowfall ]] then cp @datadir@/snowfall-conf ~/.snowfall fi TARGETDIR=$1 shift for file do FILE_EXT=`echo $file | awk -F. '{print $2}'` VIEWER="`get-value snowfall viewer $FILE_EXT`" if test -n "$VIEWER" then $VIEWER $file else `get-value snowfall viewer default` $file fi echo -n "Copy $file? " read ANSWER case $ANSWER in y) cp $file $TARGETDIR ;; e) cp $file $TARGETDIR EDITOR="`get-value snowfall editor $FILE_EXT`" if test -n "$EDITOR" then $EDITOR $TARGETDIR/$file else `get-value snowfall editor default` $TARGETDIR/$file fi ;; esac done