wok-6.x view cookutils/stuff/avoid-hard-link-exist-error.patch @ rev 24452
cyrus-imapd: configured libexecdir
author | Hans-G?nter Theisgen |
---|---|
date | Tue Feb 15 17:13:46 2022 +0100 (2022-02-15) |
parents | |
children |
line source
1 A void error "cp: cannot create hard link 'file1' to 'file2': file exists"
3 --- a/cook
4 +++ b/cook
5 @@ -423,11 +423,9 @@
6 # A bit smarter function than the classic `cp` command
8 copy() {
9 - if [ "$(stat -c %h -- "$1")" -gt 1 ]; then
10 - cp -al "$1" "$2" # copy hardlinks
11 - else
12 - cp -a "$1" "$2" # copy generic files
13 - fi
14 + [ "$(stat -c %h -- "$1")" -gt 1 ] &&
15 + cp -al "$1" "$2" 2>/dev/null || # copy hardlinks
16 + cp -a "$1" "$2" # copy generic files
17 }