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 | 4740bca | 2022-07-18 15:55:03 -0400 | [diff] [blame] | 15 | mkdir -p $1 |
bigbiff | ad58e1b | 2020-07-06 20:24:34 -0400 | [diff] [blame] | 16 | cp $src $dst |
17 | if [[ -e $2.tmp ]]; then rm -f $2.tmp; fi | ||||
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 18 | } |
19 | |||||
20 | |||||
21 | dest=$1 | ||||
22 | shift 1 | ||||
23 | for ARG in $* | ||||
24 | do | ||||
25 | process_file $dest $ARG | ||||
26 | done |