Reference: how to change `rm` to as a command like `mv ~/ .trash`
I would like to implement recycle bin utility in UNIX since UNIX not has one.
In .bashrc
file I change alias rm='move.sh"
as per above Reference guide I have written function in my move.sh script
Script : move.sh
#!/bin/sh
TRASH=<trash directory path>
move()
{
mv "$@" $TRASH;
}
move
when I run I am getting below error. Can some one please help what's wrong I am doing?
mv: Insufficient arguments (1) Usage: mv [-f] [-i] f1 f2
mv [-f] [-i] f1 ... fn d1
mv [-f] [-i] d1 d2
foo/hello.c
andbar/hello.c
. Either (a) you need to create the directory trees, or (b) you have onehello.c
in your trash but you cannot know whether it came fromfoo
orbar
. A decent Trash will preserve two or more distinct versions ofhello.c
trashed at different times, even from the same directory. It needs to store metadata to be able to untrash files, much like an archive. – Paul_Pedant Feb 19 '22 at 22:22trash-cli
), not sure about other distros. – ajgringo619 Feb 20 '22 at 01:47trash-cli
once the script is fixed. Writing your own, proper trash script is a bit more work than moving a file to a designated folder. :) – Kaffe Myers Feb 22 '22 at 20:15