Commit 3f86c641 authored by Klaatu von Schlacker's avatar Klaatu von Schlacker
Browse files

added empty as a command rather than an alias and made a more robust install script

parent 274ae509
#!/bin/sh
# remove contents of ~/.trash
ARG="$1"
if [ "X$ARG" == "X-v" ]
then
rm -rvf ~/.trash/*
else
rm -rf ~/.trash/*
fi
echo "Your trash is now empty."
#!/bin/sh
# install the humble but useful trash command
cp ./trash /usr/local/bin/trash
cp ./empty /usr/local/bin/empty
chmod +x /usr/local/bin/trash /usr/local/bin/empty
PROCHK=$(cat /etc/profile | sed -n '/alias rm="trash"/p' )
if [ "X$PROCHK" == "X" ]
then
echo 'alias rm="trash"' >> /etc/profile
source /etc/profile
fi
CHECK=$(ls /usr/local/bin | grep trash)
if [ "X$CHECK" == "X" ]
then echo "Install encountered some errors. You might try copying the apps to your home directory (into ~/bin for instance) and use them locally."
else echo "Installation script complete."
fi
#!/bin/bash
ARG="$@"
CHECK=$(ls -a ~ | grep .trash)
if [ "X$CHECK" == "X" ]
then mkdir ~/.trash
fi
if [ "X$@" != "X" ]
then
mv "$@" ~/.trash/
echo "$@ moved to Trash. Your Trash is currently $(du -h ~/.trash | cut -f1 | tail -n -1) in size."
if [ "X$ARG" == "X.trash" ]
then
echo "You cannot trash the .trash"
echo "Try issuing the command /bin/rm -rf ~/.trash instead."
else
echo "Your trash is currently $(du -h ~/.trash | cut -f1) in size."
if [ "X$ARG" != "X" ]
then
mv "$ARG" ~/.trash/
echo "$ARG moved to Trash. Your Trash is currently $(du -h ~/.trash | cut -f1 | tail -n -1) in size."
else
echo "Your trash is currently $(du -h ~/.trash | cut -f1) in size."
fi
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment