stdfilt to access child process pid
[hband-tools.git] / user-tools / delfattr
blob6c524e1c88f98fe58204e0ff8819e6da71c1e48c
1 #!/bin/bash
3 true <<'EOF'
4 =pod
6 =head1 NAME
8 delfattr - Removes given attributes (xattr) from files
10 =head1 SYNOPSIS
12 delfattr -n I<NAME> [-n I<NAME> [..]] I<FILE> [I<FILE> [...]]
14 =head1 DESCRIPTION
16 Remove I<NAME> xattribute(s) from the given files.
18 =head1 SEE ALSO
20 setfattr(1)
22 =cut
24 EOF
27 set -e
28 set -o pipefail
29 set -u
31 attr_names=()
32 files=()
34 while [ $# -gt 0 ]
36 case "$1" in
37 (-n)
38 shift
39 attr_names+=("$1")
41 (--)
42 shift
43 break
45 (-*)
46 echo "$0: unknown option: $1" >&2
47 exit 1
49 (*)
50 files+=("$1")
52 esac
53 shift
54 done
56 files+=("$@")
58 for name in "${attr_names[@]}"
60 setfattr -x "$name" "${files[@]}"
61 done