genwebgallery

diff genwebgallery @ 15:326bcd4e1708

$PROGRAM instead of basename $0; printf instead of echo -n; command -v to test for installed convert
author meillo@marmaro.de
date Sat, 19 Apr 2008 21:20:37 +0200
parents 6273a788c4fd
children 84c08287caa1
line diff
     1.1 --- a/genwebgallery	Sat Apr 19 11:38:29 2008 +0200
     1.2 +++ b/genwebgallery	Sat Apr 19 21:20:37 2008 +0200
     1.3 @@ -7,7 +7,8 @@
     1.4  #
     1.5  
     1.6  
     1.7 -VERSION=0.4
     1.8 +PROGRAM=genwebgallery
     1.9 +VERSION=0.5
    1.10  
    1.11  verbose="no"
    1.12  targetDir="webgallery"
    1.13 @@ -26,7 +27,7 @@
    1.14  	if [ -e "$targetDir" ] ; then
    1.15  		if [ "$overwrite" = "no" ] ; then
    1.16  			echo "output directory '$targetDir' already exists."
    1.17 -			echo -n "remove it? [y/n] "
    1.18 +			printf "remove it? [y/n] "
    1.19  			read remove
    1.20  		fi
    1.21  
    1.22 @@ -88,8 +89,7 @@
    1.23  
    1.24  checkConvert() {
    1.25  	log "checking convert installation"
    1.26 -	(convert -version) 2> /dev/null > /dev/null
    1.27 -	if [ $? -ne 0 ] ; then
    1.28 +	if [ ! `command -v convert` ] ; then
    1.29  		echo "Can not find 'convert' (package imagemagick)"
    1.30  		echo "ABORT"
    1.31  		exit 2
    1.32 @@ -101,18 +101,18 @@
    1.33  
    1.34  
    1.35  usage() {
    1.36 -	echo "usage: `basename $0` [OPTIONS] FILES"
    1.37 +	echo "usage: $PROGRAM [OPTIONS] FILES"
    1.38  	exit 1
    1.39  }
    1.40  
    1.41  
    1.42  
    1.43  help() {
    1.44 -	echo "`basename $0`
    1.45 +	echo "$PROGRAM
    1.46  
    1.47  generates a web gallery consisting of html pages
    1.48  
    1.49 -usage: `basename $0` [OPTIONS] PICTURES
    1.50 +usage: $PROGRAM [OPTIONS] PICTURES
    1.51  
    1.52  options:
    1.53  	--version   print program version
    1.54 @@ -122,11 +122,11 @@
    1.55  	-i FILE     the name of the index file ($index)
    1.56  	-t TEXT     title of the gallery ($galleryTitle)
    1.57  	-c TEXT     a copyright notice ($copyright)
    1.58 -	-ps PIXELS  size of the pics ($sizePic)
    1.59 +	-ps PIXELS  size of the pictures ($sizePic)
    1.60  	-ts PIXELS  size of the thumbnails ($sizeThumb)
    1.61  	--overwrite overwrite output directory ($overwrite)
    1.62  
    1.63 -for more information see man page: genwebgallery(1)
    1.64 +for more information see man page: $PROGRAM(1)
    1.65  
    1.66  author: meillo@marmaro.de
    1.67  homepage: http://prog.marmaro.de
    1.68 @@ -142,7 +142,7 @@
    1.69  while [  "$#" -ge 1  -a  `echo "$1" | awk '{print substr($0,1,1)}'` = '-'  ] ; do
    1.70  	case $1 in
    1.71  		'--version')
    1.72 -			echo "genwebgallery version $VERSION"
    1.73 +			echo "$PROGRAM version $VERSION"
    1.74  			exit 0
    1.75  			;;
    1.76  		'--help')
    1.77 @@ -188,7 +188,7 @@
    1.78  			;;
    1.79  		*)
    1.80  			echo "invalid option: $1"
    1.81 -			echo "see: `basename $0` --help"
    1.82 +			echo "see: $PROGRAM --help"
    1.83  			exit 1
    1.84  	esac
    1.85