Add rudimentary trash function

This commit is contained in:
Talia 2021-12-28 11:52:17 +01:00
parent cf14bde633
commit 7de5f862cb
1 changed files with 13 additions and 0 deletions

13
fun/trash.sh Normal file
View File

@ -0,0 +1,13 @@
#!/bin/sh
trash() {
mkdir -p $HOME/.trash
if [ -z "$@" ]; then
find $HOME/.trash -type f -exec basename {} ';'
else
for file in "$@"; do
mkdir -p $HOME/.trash/$(dirname $(realpath $file))
mv "$file" $HOME/.trash/$(realpath $file)
done
fi
}