summaryrefslogtreecommitdiff
path: root/Library/move.sh
diff options
context:
space:
mode:
Diffstat (limited to 'Library/move.sh')
-rwxr-xr-xLibrary/move.sh11
1 files changed, 9 insertions, 2 deletions
diff --git a/Library/move.sh b/Library/move.sh
index 4a15ca7..c0fc10c 100755
--- a/Library/move.sh
+++ b/Library/move.sh
@@ -21,14 +21,20 @@ function mv_() {
src=$1
mkdir -p /var/stash
- dst=$(mktemp -d /var/stash/"${src##*/}".XXXXXX)
+ tmp=$(mktemp -d /var/stash/_.XXXXXX)
+ dst=${tmp}/${src##*/}
+
+ mkdir -- "${dst}" || {
+ rmdir -- "${tmp}"
+ exit 1
+ }
if [[ -e ${src} ]]; then
chmod --reference="${src}" "${dst}"
chown --reference="${src}" "${dst}"
cp -aT $v "${src}" "${dst}" || {
- rm -rf "${dst}"
+ rm -rf "${tmp}"
exit 1
}
@@ -39,6 +45,7 @@ function mv_() {
fi
ln -s "${dst}" "${src}"
+ echo -n "${src}" >"${tmp}.lnk"
}
function shift_() {