Вы находитесь на странице: 1из 2

#!

usr/bin/perl

#Program was created by (FLJR90) "FrankQC" to help show/empty trashcan


#On the CNET Forums.

use Term::ANSIColor;
system("clear");
print "Type /? for help\n";

&main;

sub main {

print "What would you like to do?> "; chomp($input = <>);

if($input eq "/showtrash") {
&showtrash;
&main;
}elsif($input eq "/deletetrash") {
&deletetrash;
&main;
}elsif($input eq "/showtrash?") {
print color 'bold blue';
print "/showtrash will open your Trashcan in GUI window.\n";
print color 'reset';
&main;
}elsif($input eq "/deletetrash?") {
print color 'bold blue';
print "/deletetrash will delete your Trashcan.\n";
print color 'reset';
&main;
}elsif($input eq "/?") {
&commands;
&main;
}elsif($input eq "/exit") {
system("clear");
exit;
}elsif($input eq "/exit?") {
print color 'bold blue';
print "/exit exits you from the program.\n";
print color 'reset';
}else{
print "Your input of \"$input\" does not exist.\n";
&main;
}
}

sub showtrash {
system("nautilus ~/.local/share/Trash/files");
&main;
}

sub deletetrash {
print "Are you sure you want to delete trash? (Y/n)> "; chomp($deletequestion =
<>);

if($deletequestion eq "Y") {
system("sudo rm -Rf ~/.local/share/Trash/files/*");
print color 'bold blue';
print "Trash got emptied.\n";
print color 'reset';
&main;
}elsif($deletequestion eq "n") {
print color 'bold blue';
print "User does not want to delete trash.\n";
print color 'reset';
&main;
}else{
print "Your input of \"$deletequestion\" does not exist.\n";
&main;
}
}

sub commands {
print color 'bold blue';
print "Available commands are: /showtrash /deletetrash /exit\n";
print "/showtrash? /deletetrash? /exit? will tell you what they do.\n";
print color 'reset';
&main;
}

Оценить