Created
March 14, 2019 16:02
-
-
Save BANOnotIT/0ae194d8b517c3706a086fe1b6366db4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program="BEGIN{prev = \"\"} \ | |
\ | |
/^# file: / {\ | |
prev = substr(\$0, 9)\ | |
}\ | |
\ | |
/$2/ {\ | |
print prev;\ | |
prev=\"\"\ | |
}\ | |
\ | |
/^\$/ {\ | |
prev=\"\"\ | |
}" | |
OLDIFS=$IFS | |
IFS=$'\n' | |
# read all file name into an array | |
fileArray=($(getfattr -dRh $1 2>/dev/null | awk "$program")) | |
# restore it | |
IFS=$OLDIFS | |
# get length of an array | |
tLen=${#fileArray[@]} | |
# use for loop read all filenames | |
for (( i=0; i<${tLen}; i++ )); | |
do | |
setfattr -hx $2 "${fileArray[$i]}" | |
done |
Slash is missing at line 31:
setfattr -hx
Slash is missing at line 31:
setfattr -hx$2 "/$ {fileArray[$i]}"
No. This script only works with relative paths not absolute.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example
bash remove_xdg_urls.bash ~/Downloads user.xdg.origin.url