Skip to content

Instantly share code, notes, and snippets.

@itsthatguy
Last active December 30, 2015 10:39
Show Gist options
  • Save itsthatguy/7817428 to your computer and use it in GitHub Desktop.
Save itsthatguy/7817428 to your computer and use it in GitHub Desktop.

Revisions

  1. itsthatguy renamed this gist Dec 6, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. itsthatguy revised this gist Dec 6, 2013. 2 changed files with 6 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion delete-no-prompt.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    # Or if you don't want to be prompted, use this one
    # If you don't want to be prompted, use this one

    del() {
    mv -v $* $HOME/.Trash/;
    }
    4 changes: 4 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    # If all you want is to be prompted, and don't care about moving
    # files to the trash, you could use the following:

    alias rm="rm -i"
  3. itsthatguy revised this gist Dec 6, 2013. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions delete-no-prompt.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    # Or if you don't want to be prompted, use this one
    del() {
    mv -v $* $HOME/.Trash/;
    }
  4. itsthatguy revised this gist Dec 6, 2013. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions del.sh
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    # Add this to your .bash_profile, .bashrc, .zshrc or wherever you keep your bash functions and aliases.

    del() {
    RED="\e[31m"
    YELLOW="\e[33m"
  5. itsthatguy revised this gist Dec 6, 2013. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions del.sh
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,12 @@
    del() {
    autoload colors; colors;
    RED="\e[31m"
    YELLOW="\e[33m"
    WHITE="\e[97m"

    if [[ $# -eq 0 ]] ; then
    echo -e "Sorry dude, I can't do anything with that. Nothing specified."
    else
    echo -ne "$fg[yellow]You're about to move the following items to the trash:$fg[red]\n > $*\n$fg[yellow]Are you sure? [y/n] "
    echo -ne "${YELLOW}You're about to move the following items to the trash:${RED}\n > $*\n${YELLOW}Are you sure? [y/n] "
    read answer
    finish="-1"
    while [ "$finish" = '-1' ]
  6. itsthatguy created this gist Dec 6, 2013.
    30 changes: 30 additions & 0 deletions del.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    del() {
    autoload colors; colors;
    if [[ $# -eq 0 ]] ; then
    echo -e "Sorry dude, I can't do anything with that. Nothing specified."
    else
    echo -ne "$fg[yellow]You're about to move the following items to the trash:$fg[red]\n > $*\n$fg[yellow]Are you sure? [y/n] "
    read answer
    finish="-1"
    while [ "$finish" = '-1' ]
    do
    finish="1"
    if [ "$answer" = '' ];
    then
    answer=""
    else
    case $answer in
    y | Y | yes | YES )
    echo "$reset_color"
    mv -v $* $HOME/.Trash/;
    answer="y";
    ;;
    n | N | no | NO ) answer="n";;
    *) finish="-1";
    echo -n '\nInvalid response -- please reenter:';
    read answer;;
    esac
    fi
    done
    fi
    }