projects
/
carnet-tools-cn.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
r18:
[carnet-tools-cn.git]
/
functions.sh
diff --git
a/functions.sh
b/functions.sh
index
e625d51
..
5bb7ae6
100644
(file)
--- a/
functions.sh
+++ b/
functions.sh
@@
-223,8
+223,12
@@
${CP_NOTICE}----------"
cp_safe_file_replace () {
[ "$CP_SCRIPT_DEBUG" ] && set -vx
local new old
cp_safe_file_replace () {
[ "$CP_SCRIPT_DEBUG" ] && set -vx
local new old
- new=$1
- old=$2
+ if [ -z "$2" ]; then
+ echo "Usage: cp_safe_file_replace <new-file> <target-file>" 1>&2
+ return 1
+ fi
+ new="$1"
+ old="$2"
if [ -e "$old" ]; then
chown --reference "$old" "$new"
chmod --reference "$old" "$new"
if [ -e "$old" ]; then
chown --reference "$old" "$new"
chmod --reference "$old" "$new"