bigbiff | 6087339 | 2020-03-23 15:41:27 -0400 | [diff] [blame] | 1 | #!/bin/bash |
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 2 | |
3 | process_file() | ||||
4 | { | ||||
5 | dst=$1/$(basename $2) | ||||
6 | src=$2 | ||||
bigbiff | 6087339 | 2020-03-23 15:41:27 -0400 | [diff] [blame] | 7 | |
bigbiff | ad58e1b | 2020-07-06 20:24:34 -0400 | [diff] [blame] | 8 | [[ -e $src ]] || return 0 |
bigbiff | 6087339 | 2020-03-23 15:41:27 -0400 | [diff] [blame] | 9 | |
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 10 | if [ $dst == $src ]; then |
11 | cp -f -p $src $src.tmp | ||||
12 | src=$2.tmp | ||||
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 13 | fi |
14 | |||||
bigbiff | ad58e1b | 2020-07-06 20:24:34 -0400 | [diff] [blame] | 15 | cp $src $dst |
16 | if [[ -e $2.tmp ]]; then rm -f $2.tmp; fi | ||||
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 17 | } |
18 | |||||
19 | |||||
20 | dest=$1 | ||||
21 | shift 1 | ||||
22 | for ARG in $* | ||||
23 | do | ||||
24 | process_file $dest $ARG | ||||
25 | done |