Last active
November 5, 2019 01:07
-
-
Save phamduchongan93/7b871348b607f677785c557bfc7f950e to your computer and use it in GitHub Desktop.
Update rm command for linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function move_to_trash () { | |
# check if you have the backup directory. | |
if [ -d "/home/`whoami`/backup/" ]; then | |
mkdir -p "/home/`whoami`/backup/"; | |
fi | |
# copy the files or folders before deleting it. | |
cp -r "$@" "/home/`whoami`/backup/" && command rm -rf "$@" && echo "Moved to trash"; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment