A quick to set up trash alias for bash

Create the following script

~/.local/bin/move_to_trash.sh
#!/bin/sh
readonly PROGNAME=$(basename $0)
readonly PROGDIR=$(readlink -m $(dirname $0))
readonly ARGS="$@"

main() {
    local dir="/glade/scratch/${USER}/trash/$(date '+%Y/%m/%d/%H_%M')"
    mkdir -p $dir \
        && mv ${ARGS} ${dir} \
        && echo "Files moved to ${dir}"

}


main

Run chmod +x ~/.local/bin/move_to_trash.sh,

add alias trash="~/.local/bin/move_to_trash.sh" to .bashrc

Parent post: