Line | |
---|
1 | #!/bin/sh |
---|
2 | |
---|
3 | #-----[ usage ]--------------------------------------------- |
---|
4 | function usage () |
---|
5 | { |
---|
6 | echo "Usage : ${0} file"; |
---|
7 | echo "lock file, you can see the lock at \"~/.$(basename file).lock\"" |
---|
8 | exit; |
---|
9 | } |
---|
10 | |
---|
11 | #-----[ lock ]---------------------------------------------- |
---|
12 | function lock () |
---|
13 | { |
---|
14 | lockfile -1 ${1}; |
---|
15 | } |
---|
16 | |
---|
17 | #-----[ main ]---------------------------------------------- |
---|
18 | function main () |
---|
19 | { |
---|
20 | if test ${#} -ne 1 -o ! -f ${1}; then |
---|
21 | usage ${*}; |
---|
22 | fi; |
---|
23 | |
---|
24 | lock "${HOME}/.$(basename ${1}).lock" |
---|
25 | } |
---|
26 | |
---|
27 | #-----[ Corps ]--------------------------------------------- |
---|
28 | main ${*} |
---|
Note: See
TracBrowser
for help on using the repository browser.