1: #!/bin/bash
2:
3: VERSION="changemany V0.1 (29.6.2006 ROC)"
4:
5: #set -x
6:
7: if [ -z "$1$2" ]
8: then
9: echo $VERSION
10: echo "use: $0 dirlist [params...]"
11: echo " Changes the document directories given in the file dirlist."
12: echo " The list has the full pathname first and then one column per parameter, separated with spaces."
13: exit 1
14: fi
15:
16: DIRLIST="$1"
17: PARAM1="$2"
18: PARAM2="$3"
19: PARAM3="$4"
20:
21: if [ ! -f $DIRLIST ]
22: then
23: echo "ERROR: directory list file $DIRLIST not found!"
24: exit 1
25: fi
26:
27: CNT=0
28:
29: # read directories and options from DIRLIST
30: while read DIR OPT1 OPT2 OPT3
31: do
32: CNT=$(( $CNT + 1 ))
33: if [ -d "$DIR" ]
34: then
35: echo "changing document $CNT: $DIR..."
36: if /usr/local/mpiwg/archive/changemeta "${PARAM1:+$PARAM1=$OPT1}" "${PARAM2:+$PARAM2=$OPT2}" "${PARAM3:+$PARAM3=$OPT3}" "$DIR"
37: then
38: echo " OK"
39: else
40: echo "FAILED!"
41: # abort?
42: fi
43: else
44: echo "$CNT ERROR: document directory $DIR not found!"
45: fi
46: done < $DIRLIST
47:
48: if [ $CNT = 0 ]
49: then
50: echo "ERROR: the list file $DIRLIST seems to be empty!"
51: else
52: echo "Processed $CNT documents!"
53: fi
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>