handle case when file and dest have same basenames
This commit is contained in:
parent
9ca7b1c590
commit
36435d6773
@ -155,15 +155,17 @@ copy_file()
|
||||
|
||||
# iterate throught symlinks and copy them
|
||||
while [ -h "$file" ]; do
|
||||
cp -P "$file" "${tmpdir}${dest}" || panic
|
||||
cp -P "$file" "${tmpdir}${dest%/*}/${file##*/}"
|
||||
cd -P "${file%/*}"
|
||||
|
||||
symlink=$(ls -ld "$file")
|
||||
symlink="${symlink##* -> }"
|
||||
|
||||
file="${PWD}/${symlink##*/}"
|
||||
done
|
||||
|
||||
# handle case when file and dest have same basenames
|
||||
[ -h "${tmpdir}${dest}" ] && dest="${dest%/*}/${file##*/}"
|
||||
|
||||
{
|
||||
cp "$file" "${tmpdir}${dest}"
|
||||
chmod "$mode" "${tmpdir}${dest}"
|
||||
|
Loading…
Reference in New Issue
Block a user