switch -k funktioniert

This commit is contained in:
Kamil Bugajski
2012-08-16 21:06:52 +02:00
parent 5a5c5f36eb
commit 32d0eea3dd
+7 -3
View File
@@ -9,6 +9,7 @@ Usage: `basename $0` [-h] [-i] [-j nb_jobs] command arg_list
-h Shows this help -h Shows this help
-c give the path to the cfg file -c give the path to the cfg file
-i give the path of the svg files without the last / -i give the path of the svg files without the last /
-k chek if the jpg already exist
-j Set number of simultanious jobs. Default is 2 -j Set number of simultanious jobs. Default is 2
-o directory where the files should be moved to after creation. -o directory where the files should be moved to after creation.
Default ist PICCREATE_OUT Default ist PICCREATE_OUT
@@ -114,12 +115,14 @@ if [ $# -eq 0 ]; then # must be at least one arg
exit 1 exit 1
fi fi
while getopts "j:i:k:o:hc:" OPT; do # "j:" waits for an argument "h" doesnt CHECKFILE=0
while getopts "j:i:kc:o:hc:" OPT; do # "j:" waits for an argument "h" doesnt
case $OPT in case $OPT in
h) echo "$USAGE" h) echo "$USAGE"
exit 0 ;; exit 0 ;;
j) MAX_NPROC=$OPTARG ;; j) MAX_NPROC=$OPTARG ;;
k) CHECKFILE=$OPTARG ;; k) CHECKFILE=1 ;;
c) CFG_FILENAME=$OPTARG ;; c) CFG_FILENAME=$OPTARG ;;
o) OUTDIR=$OPTARG ;; o) OUTDIR=$OPTARG ;;
i) INPUT_FILENAME=$OPTARG ;; i) INPUT_FILENAME=$OPTARG ;;
@@ -137,10 +140,11 @@ echo $INPUT_FILE
for i in `ls $INPUT_FILE| grep .svg ` for i in `ls $INPUT_FILE| grep .svg `
do do
echo $i echo $i
echo $CHECKFILE
ID=`echo "$i" | sed -e 's/;.*//g'` ID=`echo "$i" | sed -e 's/;.*//g'`
PIC_NAME=`echo "$i" | sed -e 's/.svg/.jpg/g'` PIC_NAME=`echo "$i" | sed -e 's/.svg/.jpg/g'`
FILE_PATH=$INPUT_FILE/$PIC_NAME FILE_PATH=$INPUT_FILE/$PIC_NAME
if [ -s $FILE_PATH ] if [ -s $FILE_PATH ] && [ $CHECKFILE -eq 1 ]
then then
echo $PIC_NAME exists! echo $PIC_NAME exists!
else else