use mktemp for temp files
This commit is contained in:
parent
aaa6aac2fd
commit
3f73d4b9c8
11
calc_md5.sh
11
calc_md5.sh
@ -1,13 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd /mnt/export
|
||||
md5_tmp=`mktemp`
|
||||
|
||||
#sort & del dublicates
|
||||
sed -i '/^$/d' md5.txt
|
||||
cat md5.txt | sort -k 2 | uniq > md5.txt_tmp
|
||||
cat md5.txt_tmp > md5.txt
|
||||
cat md5.txt | sort -k 2 | uniq > $md5_tmp
|
||||
cat $md5_tmp > md5.txt
|
||||
|
||||
cat md5.txt_tmp | while read line; do
|
||||
cat $md5_tmp | while read line; do
|
||||
#get md5
|
||||
md5=$(echo $line | cut -c -32)
|
||||
|
||||
@ -40,5 +41,5 @@ done
|
||||
}
|
||||
|
||||
#sort & del dublicates
|
||||
cat md5.txt | sort -k 2 | uniq > md5.txt_tmp
|
||||
rm md5.txt && mv md5.txt_tmp md5.txt
|
||||
cat md5.txt | sort -k 2 | uniq > $md5_tmp
|
||||
rm md5.txt && mv $md5_tmp md5.txt
|
||||
|
Loading…
Reference in New Issue
Block a user