summaryrefslogblamecommitdiff
path: root/tools/apply-filter
blob: a1cd79d25ca185f321cfbb3ba79e111c75d0d20c (plain) (tree)
1
2
3
4
5
6
7
8
9



                                          
                            


                                      
                                                            

                              
#!/bin/bash -eu
# Apply a filter command to a set of files

filter=$1; shift
trap 'rm -f "$arg.tmp"' EXIT
for arg
do
    echo apply-filter "$filter" "$arg"
    bash -c "set -o pipefail; $filter" < "$arg" > "$arg.tmp"
    maybe-mv "$arg.tmp" "$arg"
done