Magellan Linux

Contents of /trunk/mage/usr/lib/mage/writeprotected

Parent Directory Parent Directory | Revision Log Revision Log


Revision 33 - (show annotations) (download)
Thu Jan 6 02:57:12 2005 UTC (19 years, 4 months ago) by niro
File size: 704 byte(s)
fixed version tags

1 #!/bin/bash
2 # version: 0.3.6-r9
3
4 FILE=$1
5 DIR=$(dirname ${FILE})
6 FILENAME=$(basename ${FILE})
7
8 # check if there are already protected file
9 # set counter to HIGHEST FILE +1
10 for oldpretected in $(find ${DIR} -iname "._cfg????_${FILENAME}" |
11 sed -e "s:\(^.*/\)\(._cfg*_\)\(/.*$\):\1\2\3\%\2\%\3:" |
12 sort -t'%' -k3 -k2 | cut -f1 -d'%')
13 do
14 COUNTER=$(echo ${oldpretected}|cut -d_ -f2|sed -e "s:cfg::")
15 done
16
17 #if counter is zero than set to 0001 else to ${COUNTER}+1
18 if [ -z "${COUNTER}" ]
19 then
20 COUNTER=0001
21 else
22 #set COUNTER +1
23 #this is a tricky one:
24 #exp COUNTER may be 0901
25 # exp ${COUNTER} + 1 is 902 NOT 0902
26
27 COUNTER=${COUNTER/$(expr ${COUNTER} + 0)/$(expr ${COUNTER} + 0001)}
28 fi
29
30 echo ${COUNTER}

Properties

Name Value
svn:executable *