3 #=======================================================================
5 # File ID: aad4fde6-02e6-11de-acfb-000475e441b9
6 # Kjører ei fil ($2 osv) gjennom et filter som spesifiseres som $1.
7 # License: GNU General Public License version 2 or later.
8 #=======================================================================
11 test "$1" = "-u" && { use_lock
=0; shift; }
17 # cp -p $ff $ff.filt-bck
18 if test "$use_lock" = "1"; then
20 until mkdir
"$ff.lock"; do
21 echo filt
: $ff: Waiting
for lock...
>&2
25 test "$lock_wait" = "1" && { echo filt
: $ff: Obtained lock
>&2; }
27 cat "$ff" |
$cmd >"$ff.filt.tmp"
28 retval
=$
[$retval | $?
];
29 chmod --reference "$ff" "$ff.filt.tmp"
30 mv "$ff.filt.tmp" "$ff"
31 if test "$use_lock" = "1"; then
32 rmdir "$ff.lock" ||
{ echo filt
: $ff.lock
: Lockdir unexpectedly disappeared
>&2; }
35 echo filt
: $ff: Not a regular
file >&2
36 retval
=$
[$retval |
1];