Hi,
did you not like these?
http://git.ipfire.org/?p=network.git;a=blob;f=src/functions/functions.lock;h...
-Michael
On Mon, 2017-06-19 at 21:20 +0200, Jonatan Schlag wrote:
This function easily lock or unlock a file.
Signed-off-by: Jonatan Schlag jonatan.schlag@ipfire.org
src/functions/functions.util | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/src/functions/functions.util b/src/functions/functions.util index 4b6f956..23e5a4b 100644 --- a/src/functions/functions.util +++ b/src/functions/functions.util @@ -738,3 +738,17 @@ hex2dec() { dec2hex() { printf "%02x\n" "${1}" }
+lock_file() {
- assert [ $# -eq 1 ]
- local file=${1}
- touch "${file}.lock"
+}
+unlock_file() {
- assert [ $# -eq 1 ]
- local file=${1}
- rm -f "${file}.lock"
+}