Skip to content

Instantly share code, notes, and snippets.

@commanda commanda/del
Last active May 18, 2016

Embed
What would you like to do?
A bash script that moves the given file or directory into the Trash.
#!/bin/sh
TRASH="$HOME/.Trash/";
args=("$@");
for f in $args; do
base=$(basename $f);
if [ -e "$TRASH$base" ] ; then
TS=`date`;
mv -f $f "$TRASH/$base $TS";
else
mv -f $f "$TRASH/$base";
fi
done
# alias rm="echo Use 'del', or the full path i.e. '/bin/rm'"
@jpf

This comment has been minimized.

Copy link

jpf commented Apr 19, 2016

I like date +%s for these sorts of things, since it's short and doesn't have spaces that make some applications sad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.