dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 95a84067eb35e13a5607e3a12d0ee9e61abb4a81
parent 0de444bb05411719aa67bc8548448a4a3b640517
Author: Alex Balgavy <alex@balgavy.eu>
Date:   Sat,  2 Oct 2021 19:40:44 +0200

trash: try appending numbers if same name already exists

Diffstat:
Mscripts/trash | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/trash b/scripts/trash @@ -74,5 +74,7 @@ done eval set -- "$PARAMS" for f in "$@"; do - [ -e "$f" ] && mv "$f" "${TRASHDIR:?}/" && printf "Trashed %s\n" "$f" + destname="${f##*/}" + ctr=0; while [ -e "$TRASHDIR/$destname" ]; do destname="${f##*/}.$ctr"; ctr=$((ctr+1)); done + [ -e "$f" ] && mv "$f" "${TRASHDIR:?}/$destname" && printf "Trashed %s\n" "$f" done