use vars for all paths

This commit is contained in:
6543 2019-09-13 12:31:57 +02:00
parent 2ac4b204e1
commit 0256d54ff7
Signed by: 6543
GPG Key ID: A1CA74D27FD13271
1 changed files with 17 additions and 11 deletions

28
select
View File

@ -1,31 +1,37 @@
#!/bin/bash #!/bin/bash

md5_source="2cp.md5"
md5_source_rm="2rm.md5"

md5_aim="aim.md5"

#wenn delete file exits -> handle deletons (importand for konflict handling #wenn delete file exits -> handle deletons (importand for konflict handling
[ -f 2rm.md5 ] && { [ -f "${md5_source_rm}" ] && {
cat 2rm.md5 | cut -c -32 | while read line; do cat "${md5_source_rm}" | cut -c -32 | while read line; do
sed -i "/$line/d" aim.md5 sed -i "/$line/d" "${md5_aim}"
done done
cat 2rm.md5 | cut -c 35- | while read line; do cat "${md5_source_rm}" | cut -c 35- | while read line; do
l=$(grep " $line"$ aim.md5) l=$(grep " $line"$ "${md5_aim}")
[ -n "$l" ] && { [ -n "$l" ] && {
echo $l echo $l
md5=$(echo $l | cut -c -32) md5=$(echo $l | cut -c -32)
sed -i "/$md5/d" aim.md5 sed -i "/$md5/d" "${md5_aim}"
} }
done done
rm 2rm.md5 rm ${md5_source_rm}
} }


#gleiche dateien anhand md5 aussortieren #gleiche dateien anhand md5 aussortieren
cat aim.md5 | cut -c -32 | while read line; do sed -i "/$line/d" 2cp.md5 ; done cat "${md5_aim}" | cut -c -32 | while read line; do sed -i "/$line/d" "${md5_source}" ; done


#dateien die verschiedenen md5 haben aber bei beiden existieren als konflikte behandeln #dateien die verschiedenen md5 haben aber bei beiden existieren als konflikte behandeln
echo Konflicts: echo Konflicts:
echo echo
cat aim.md5 | cut -c 35- | while read line; do cat "${md5_aim}" | cut -c 35- | while read line; do
l=$(grep " $line"$ 2cp.md5 | tee -a konflicts) l=$(grep " $line"$ "${md5_source}" | tee -a konflicts)
[ -n "$l" ] && { [ -n "$l" ] && {
echo $l echo $l
md5=$(echo $l | cut -c -32) md5=$(echo $l | cut -c -32)
sed -i "/$md5/d" 2cp.md5 sed -i "/$md5/d" "${md5_source}"
} }
done done